From patchwork Wed Jul 1 02:12:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 50502 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CD6CA218E4 for ; Wed, 1 Jul 2015 02:12:52 +0000 (UTC) Received: by wiwz6 with SMTP id z6sf12127816wiw.0 for ; Tue, 30 Jun 2015 19:12:52 -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=qX/eiEaWqolIceRg9H5xKRgDg3+QlJQuVbo6I2RyVs4=; b=PYYMEcWG4aAkBMqyG5+t5HIjNWOjTqbuF+0w5b3pNH4/VbJ0Pj/9fPr05+qr9qJxlq yVWI591iGnR1IBLXCTpWkkax1Fi28fUo4d3kQ7QNKqz1GwtfIGNzWTbQ4cunabRIZvvA HQ+xEHlpZq4NS3h1XD1UkTHZpEz+l3ng9wC+TjU7VCJOcSEeIIz6GozTFEAIc45Xm5VO jOrc4ctqMmNHYfz0/xfNPyNhWglBkUnnuUhIXY5caponJj93AmX7IyUNhWOjKpfaeWw4 WyK9yx2eFTN66I8jIiX6wK5339On+NlzxH9D+TJCV/et4QeE1mo6Ed09Degc6PoVizFf +qlA== X-Gm-Message-State: ALoCoQneC+V2S697SWYReKcqcmrAVi19LffG1QcVOA7yz1bwd+mJW/5+ktNIYWgm6+TF95wvsTZN X-Received: by 10.180.81.170 with SMTP id b10mr487435wiy.4.1435716772454; Tue, 30 Jun 2015 19:12:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.9 with SMTP id ky9ls105075lab.98.gmail; Tue, 30 Jun 2015 19:12:52 -0700 (PDT) X-Received: by 10.153.4.40 with SMTP id cb8mr22400473lad.105.1435716772277; Tue, 30 Jun 2015 19:12:52 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id cj1si307685lad.86.2015.06.30.19.12.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 19:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lagh6 with SMTP id h6so31446959lag.2 for ; Tue, 30 Jun 2015 19:12:52 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr22616083laj.19.1435716772159; Tue, 30 Jun 2015 19:12:52 -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 hn6csp282415lbb; Tue, 30 Jun 2015 19:12:51 -0700 (PDT) X-Received: by 10.140.233.140 with SMTP id e134mr32235734qhc.63.1435716770741; Tue, 30 Jun 2015 19:12:50 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g140si489880qhc.92.2015.06.30.19.12.50; Tue, 30 Jun 2015 19:12:50 -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 881B861F0D; Wed, 1 Jul 2015 02:12:49 +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 106CD61F0A; Wed, 1 Jul 2015 02:12:21 +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 8205461E59; Wed, 1 Jul 2015 02:12:18 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by lists.linaro.org (Postfix) with ESMTPS id 6D7BC61E59 for ; Wed, 1 Jul 2015 02:12:16 +0000 (UTC) Received: by oiyy130 with SMTP id y130so21849524oiy.0 for ; Tue, 30 Jun 2015 19:12:16 -0700 (PDT) X-Received: by 10.202.240.215 with SMTP id o206mr21442276oih.94.1435716736450; Tue, 30 Jun 2015 19:12:16 -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 y131sm251679oig.28.2015.06.30.19.12.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jun 2015 19:12:16 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 30 Jun 2015 21:12:10 -0500 Message-Id: <1435716730-30445-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435716730-30445-1-git-send-email-bill.fischofer@linaro.org> References: <1435716730-30445-1-git-send-email-bill.fischofer@linaro.org> X-Topics: Classification patch Subject: [lng-odp] [RFC PATCHv2 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.42 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 | 106 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index f597b26..1829f74 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 @@ -59,6 +69,48 @@ extern "C" { * Invalid odp_pmr_set_t value. */ + /** + * 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 */ @@ -263,6 +315,46 @@ 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 root the PMR with new_ctx that represents the root + * of changes--may be used by the implementation + * to optimize handling of partial changes to + * a classification tree. Specify as NULL if + * changes have no specific starting node or if + * the context contains PMR sets. + * @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_pmr_t root, + 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 @@ -358,6 +450,20 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t src_pktio, odp_cos_t dst_cos); /** + * Apply a PMR set to a classification context to assign a CoS. + * + * @param[in] ctx Classification context to which + * this PMR set is to be applied + * @param[in] pmr_set_id PMR set 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_set_cos(odp_cls_context_t ctx, + odp_pmr_set_t pmr_set_id, odp_cos_t dst_cos); + +/** * Get printable value for an odp_cos_t * * @param hdl odp_cos_t handle to be printed