From patchwork Thu Jun 25 13:52:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 50322 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 90F68228FD for ; Thu, 25 Jun 2015 13:54:04 +0000 (UTC) Received: by wguu7 with SMTP id u7sf19489196wgu.0 for ; Thu, 25 Jun 2015 06:54:03 -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: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=c5BuVEiWRMJuD/me3pjL2jfNnEi9uQTjpJepb/PG2wo=; b=MM8KH/YbXNqySLIIgmyxHpb+0TpULjVMfQkgkK//ZsInf1NutaETNVxv/FSg9ulwoz tQoi7ishl35CgIIt9D4+ZhHh9ZuwM2JJ68e458Vbiu+IOz9ILytC0b5uXT+dIb2+kDtV 8nhoFMGSShYbpZRJdPb4Js4PUElAshc00tks8rxfB5yzA9N+8fT/g31Wp91mkhw9mjt1 6J+tHEIZHC6E1d9Hau2+6Yef9ktJwILNnojUBpYJ0pcdxZgm6Qec1lKlyrW0tNqBPRs9 XKrIAU6BiQBIOqsJF3lMNKrx3SjVmfAREH1N4NWf7TrrlcMCzivtbO6zJqKBlcd6UCRj dGuw== X-Gm-Message-State: ALoCoQkw0DtcfECUDS/Xj6EfWjUGzIQmlBPgu8aTVzr/7Ojm28SyRj58wqeOeMmCqIzt7FwJY5Eo X-Received: by 10.112.85.69 with SMTP id f5mr10216677lbz.23.1435240443854; Thu, 25 Jun 2015 06:54:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls395240laz.2.gmail; Thu, 25 Jun 2015 06:54:03 -0700 (PDT) X-Received: by 10.152.43.69 with SMTP id u5mr44363927lal.119.1435240443705; Thu, 25 Jun 2015 06:54:03 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id t18si11882700laz.137.2015.06.25.06.54.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2015 06:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lacny3 with SMTP id ny3so45362233lac.3 for ; Thu, 25 Jun 2015 06:54:03 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr44991174lbp.88.1435240443570; Thu, 25 Jun 2015 06:54:03 -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 hn6csp623358lbb; Thu, 25 Jun 2015 06:54:02 -0700 (PDT) X-Received: by 10.55.26.34 with SMTP id a34mr25849115qka.90.1435240441952; Thu, 25 Jun 2015 06:54:01 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z105si29366161qgz.67.2015.06.25.06.54.01; Thu, 25 Jun 2015 06:54:01 -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 1555661DD5; Thu, 25 Jun 2015 13:54:01 +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_H2, 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 67AE061DBA; Thu, 25 Jun 2015 13:52:57 +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 62A8F61DD5; Thu, 25 Jun 2015 13:52:54 +0000 (UTC) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by lists.linaro.org (Postfix) with ESMTPS id 1D00461DBA for ; Thu, 25 Jun 2015 13:52:39 +0000 (UTC) Received: by oiax193 with SMTP id x193so52853024oia.2 for ; Thu, 25 Jun 2015 06:52:38 -0700 (PDT) X-Received: by 10.202.189.212 with SMTP id n203mr26752770oif.24.1435240358527; Thu, 25 Jun 2015 06:52:38 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id w187sm3764344oiw.12.2015.06.25.06.52.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jun 2015 06:52:38 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 25 Jun 2015 08:52:29 -0500 Message-Id: <1435240349-29763-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435240349-29763-1-git-send-email-bill.fischofer@linaro.org> References: <1435240349-29763-1-git-send-email-bill.fischofer@linaro.org> X-Topics: Classification patch Subject: [lng-odp] [RFC PATCH 2/2] api: classification: add odp_cls_context routines for stateful classification 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.215.47 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: Bill Fischofer --- include/odp/api/classification.h | 87 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index f597b26..3f7b1b7 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -24,6 +24,16 @@ extern "C" { * @{ */ +/** + * @typedef odp_cls_context_t + * Context for classification rule chains + */ + +/** + * @def ODP_CLS_CONTEXT_INVALID + * This value is the "null context" used to represent + * no context. + */ /** * @typedef odp_cos_t @@ -43,7 +53,7 @@ extern "C" { */ /** - * @def ODP_COS_NAME_LEN + * @def ODP_COS_NAME_LEN * Maximum ClassOfService name length in chars */ @@ -60,6 +70,48 @@ extern "C" { */ /** + * Create a classification context + * + * @param name Name for context lookup, or NULL for anonymous + * + * @return ctx Classification context handle + * @retval ODP_CLS_CONTEXT_INVALID on failure + */ +odp_cls_context_t odp_cls_context_create(const char *name); + +/** + * Destroy a classification context + * + * @param ctx Classification context handle + * @retval 0 on success + * @retval <0 on failure + */ +int odp_cls_context_destroy(odp_cls_context_t ctx); + +/** + * Lookup a classification context + * + * @param name String name of the context to be retrieved + * + * @return ctx Classification context handle + * @retval ODP_CLS_CONTEXT_INVALID on lookup failure + */ +odp_cls_context_t odp_cls_context_lookup(const char *name); + +/** + * Get printable value for an odp_cls_context_t + * + * @param ctx Handle to be printed + * @return uint64_t value that can be used to print/display + * this handle + * + * @note This routine is intended to be used for diagnostic purposes + * to enable applications to generate a printable value that represents + * an odp_cls_context_t handle. + */ +uint64_t odp_cls_context_to_u64(odp_cls_context_t ctx); + +/** * Class-of-service packet drop policies */ typedef enum odp_cos_drop { @@ -263,6 +315,39 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id, odp_pktio_t src_pktio, odp_cos_t dst_cos); /** + * Apply a PMR to a classification context to assign a CoS. + * + * @param[in] ctx Classification context to which + * this PMR is to be applied + * @param[in] pmr_id PMR to be activated + * @param[in] dst_cos CoS to be assigned by this PMR + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_cls_context_pmr_cos(odp_cls_context_t ctx, + odp_pmr_t pmr_id, odp_cos_t dst_cos); + +/** + * Apply a classification context to a pktio to make it active + * + * @param src_pktio pktio to which this context is to be applies + * @param new_ctx context to be applied to this pktio + * @param[out] old_ctx prior context that was applied to this pktio + * + * @retval 0 on success + * @retval <0 on failure + * + * @note Applying a classification context to a pktio that has no current + * context returns ODP_CLS_CONTEXT_INVALID as the old_ctx. Similarly, to + * remove a classification context from a pktio use ODP_CLS_CONTEXT_INVALID + * as the new_ctx. + */ +int odp_pktio_cls_context_swap(odp_pktio_t src_pktio, + odp_cls_context_t new_ctx, + odp_cls_context_t *old_ctx); + +/** * Cascade a PMR to refine packets from one CoS to another. * * @param[in] pmr_id PMR to be activated