From patchwork Thu Apr 16 09:54:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 47241 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DCDD320553 for ; Thu, 16 Apr 2015 09:54:38 +0000 (UTC) Received: by wixv7 with SMTP id v7sf17669446wix.0 for ; Thu, 16 Apr 2015 02:54:38 -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: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=u4OkLbm1JFqWjGyt1VstUASsYzuP2az6EVLq65XEsj8=; b=QyGRidGVUbqxtb3DoZSnhVc8yzg3AkgzHOFthOxFjGD2pnsopIey8DUCMFHD2FgkOT V6Eud9yLfJODI9vaKcux9N4yKLRf1noz/vsQu1/BjlZ1ZHfLbU2olY4Gt9H6otGASAVg xpS9IDci2++QpS4o8bBoSgad7fBQC2dW9E/N5Ldl55yBJKz2VVeBJ2aXXmlci7733urY hHZwguGIo4b2cf0yRc0FSWJqttoHrx2+OGAjEg/hD9A7reezRGtrMOg4pVLv7k0Mv71e SvRHl0xc6CbEaoLK5UBX32h0qWM2R25NChemfKYTA/3Z6FJ9aOQ+0Mfjj9fLAq1tJegD 2vPg== X-Gm-Message-State: ALoCoQmKlRn4WtE0ZfyIDsII+WfAPEi2UjgGjxZkbZKMLSVfBuR4UR3yHzAJV+35VIqyO/XMLUCb X-Received: by 10.180.105.226 with SMTP id gp2mr1418885wib.1.1429178078197; Thu, 16 Apr 2015 02:54:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.104 with SMTP id j8ls254168laj.106.gmail; Thu, 16 Apr 2015 02:54:37 -0700 (PDT) X-Received: by 10.152.44.161 with SMTP id f1mr27704302lam.26.1429178077788; Thu, 16 Apr 2015 02:54:37 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id h5si6047461laa.48.2015.04.16.02.54.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2015 02:54:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbzk7 with SMTP id zk7so54518676lbb.0 for ; Thu, 16 Apr 2015 02:54:37 -0700 (PDT) X-Received: by 10.112.125.167 with SMTP id mr7mr27948446lbb.106.1429178077324; Thu, 16 Apr 2015 02:54:37 -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.67.65 with SMTP id l1csp3021834lbt; Thu, 16 Apr 2015 02:54:36 -0700 (PDT) X-Received: by 10.55.52.129 with SMTP id b123mr53104141qka.34.1429178075945; Thu, 16 Apr 2015 02:54:35 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 93si7730713qky.97.2015.04.16.02.54.35; Thu, 16 Apr 2015 02:54:35 -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 26CA161FFA; Thu, 16 Apr 2015 09:54:35 +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=unavailable autolearn_force=no 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 198AC61FE5; Thu, 16 Apr 2015 09:54:32 +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 A9A2761FF5; Thu, 16 Apr 2015 09:54:30 +0000 (UTC) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by lists.linaro.org (Postfix) with ESMTPS id C201261FE5 for ; Thu, 16 Apr 2015 09:54:29 +0000 (UTC) Received: by lagv1 with SMTP id v1so52614622lag.3 for ; Thu, 16 Apr 2015 02:54:28 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr27194841lbb.76.1429178068736; Thu, 16 Apr 2015 02:54:28 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id yq18sm1555607lbb.47.2015.04.16.02.54.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Apr 2015 02:54:28 -0700 (PDT) From: Taras Kondratiuk To: Leonid.Rosenboim@caviumnetworks.com, bala.manoharan@linaro.org Date: Thu, 16 Apr 2015 12:54:23 +0300 Message-Id: <1429178063-19859-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: Classification patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [API-NEXT PATCH] api: classification: connect PMR on creation 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: taras.kondratiuk@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.176 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 Current odp_pmr_t usage model has several issues: 1. The same PMR can be applied into different places in a classification tree, but there is no way to modify each of its applications separately. One can only destroy a rule completely which should destroy all of its instances in a classification tree. 2. Initial intention behind odp_pmr_t was to abstract a handle to some HW resource which imlements a PMR. But on platforms I'm aware of a separate HW resource should be allocated for each PRM application. So there is no 1:1 mapping between odp_pmr_t and HW resource. If odp_pmr_t doesn't map to HW resource directly, then it just represent a PRM description. It is an entry in some PRM descriptions 'database' which implementation have to maintain for no good reason. There are two possible solutions: 1. Create odp_pmr_t handle as a result of a rule application/connection. 2. Connect rule on odp_pmr_t creation (suggested by Leonid Rosenboim). I prefer a second solution because it is more compact and straight forward. Additional consequence of this solution: instead of connecting PMR to PktIO it is connected to PktIO's default CoS. Signed-off-by: Taras Kondratiuk --- include/odp/api/classification.h | 59 ++++++++++++---------------------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index 7db3645..ef7d81e 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -232,6 +232,9 @@ typedef enum odp_pmr_term { * @param[in] val_sz Size of the val and mask arguments, * that must match the value size requirement of the * specific term. + * @param[in] src_cos CoS to be filtered + * @param[in] dst_cos CoS to be assigned to packets filtered from src_cos + * that match this rule. * * @return Handle of the matching rule * @retval ODP_PMR_INVAL on failure @@ -239,7 +242,9 @@ typedef enum odp_pmr_term { odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, const void *val, const void *mask, - uint32_t val_sz); + uint32_t val_sz, + odp_cos_t src_cos, + odp_cos_t dst_cos); /** * Create a packet match rule with value range @@ -250,6 +255,9 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, * @param[in] val_sz Size of the val1 and val2 arguments, * that must match the value size requirement of the * specific term. + * @param[in] src_cos CoS to be filtered + * @param[in] dst_cos CoS to be assigned to packets filtered from src_cos + * that match this rule. * * @return Handle of the matching rule * @retval ODP_PMR_INVAL on failure @@ -258,7 +266,10 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term, odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term, const void *val1, const void *val2, - uint32_t val_sz); + uint32_t val_sz, + odp_cos_t src_cos, + odp_cos_t dst_cos); + /** * Invalidate a packet match rule and vacate its resources * @@ -270,32 +281,6 @@ odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term, int odp_pmr_destroy(odp_pmr_t pmr_id); /** - * Apply a PMR to a pktio to assign a CoS. - * - * @param[in] pmr_id PMR to be activated - * @param[in] src_pktio pktio to which this PMR is to be applied - * @param[in] dst_cos CoS to be assigned by this PMR - * - * @retval 0 on success - * @retval <0 on failure - */ -int odp_pktio_pmr_cos(odp_pmr_t pmr_id, - odp_pktio_t src_pktio, odp_cos_t dst_cos); - -/** - * Cascade a PMR to refine packets from one CoS to another. - * - * @param[in] pmr_id PMR to be activated - * @param[in] src_cos CoS to be filtered - * @param[in] dst_cos CoS to be assigned to packets filtered - * from src_cos that match pmr_id. - * - * @retval 0 on success - * @retval <0 on failure - */ -int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t dst_cos); - -/** * Inquire about matching terms supported by the classifier * * @return A mask one bit per enumerated term, one for each of op_pmr_term_e @@ -356,6 +341,9 @@ typedef struct odp_pmr_match_t { * @param[in] num_terms Number of terms in the match rule. * @param[in] terms Array of num_terms entries, one entry per * term desired. + * @param[in] src_cos CoS to be filtered + * @param[in] dst_cos CoS to be assigned to packets filtered from + * src_cos that match all terms. * @param[out] pmr_set_id Returned handle to the composite rule set. * * @return the number of terms elements @@ -364,6 +352,7 @@ typedef struct odp_pmr_match_t { * @retval <0 on failure */ int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms, + odp_cos_t src_cos, odp_cos_t dst_cos, odp_pmr_set_t *pmr_set_id); /** @@ -385,20 +374,6 @@ int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms, int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id); /** - * Apply a PMR Match Set to a pktio to assign a CoS. - * - * @param[in] pmr_set_id PMR match set to be activated - * @param[in] src_pktio pktio to which this PMR match - * set is to be applied - * @param[in] dst_cos CoS to be assigned by this PMR match set - * - * @retval 0 on success - * @retval <0 on failure - */ -int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t src_pktio, - odp_cos_t dst_cos); - -/** * Get printable value for an odp_cos_t * * @param hdl odp_cos_t handle to be printed