From patchwork Fri Jan 22 11:54:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 60129 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp618935lbb; Fri, 22 Jan 2016 03:54:32 -0800 (PST) X-Received: by 10.55.73.6 with SMTP id w6mr2891230qka.82.1453463668731; Fri, 22 Jan 2016 03:54:28 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v67si6828185qgv.34.2016.01.22.03.54.28; Fri, 22 Jan 2016 03:54:28 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C1E98617E3; Fri, 22 Jan 2016 11:54:27 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=eGVq0rDe; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,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 0BD93616CA; Fri, 22 Jan 2016 11:54:22 +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 1964D617AA; Fri, 22 Jan 2016 11:54:20 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by lists.linaro.org (Postfix) with ESMTPS id D8A27616C2 for ; Fri, 22 Jan 2016 11:54:18 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id n128so41194922pfn.3 for ; Fri, 22 Jan 2016 03:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=StDacvKKAlGVw7muYw8QHVkRl5DeyMJMQrF5DRVbAWU=; b=eGVq0rDeDTnAVE/VCM12QCqehGUD+JMNJHUiLZecMaintPiU7FaUjy+YfzYp9HMxeV Kwft1bz3u5hTZZdvxis05CTE7rA08NMXAU0775iCzkI6Uli9aYZOxbX+0SMx4GDB7SvA 1IDbcO3igrdQ2pQS8vX3AiyRnPz/b/yaIj6bE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=StDacvKKAlGVw7muYw8QHVkRl5DeyMJMQrF5DRVbAWU=; b=ETffen5RLj8vhEtHNWCkFG2cqT8QYfJMPlCMwS1cBLs//4lqTncVC3rqnsUuh2ouvG 2iuOkDD0HMErIndCUZq9XxUMcFBlPnxVNctogRelTDm1GFta1wk1iAWeVRt4A+nOSNfG fBv+diyfoAfH1Ht/NTl4c5cQoOZVKK0wQP1sHJQ+FwPQNM5MP9qA0RNXC2mzuHCrnF7r mhWfHf7I3DBKlg2RPrbXVpDRZpfUsSqgx3Yn0cOYd5IEK8pTAOn7I/TWBQrYQteYM3p5 sfONByWELU+zXIbJ9O8uPIiEIKL2EPS8WO56sPTEFEUaamHwJN6Hew55VaRjXQlTK/XO IuYw== X-Gm-Message-State: AG10YOTxJ6AFCbh/1CoHKgEd2/+TbgrjwVE6X/kGfk4ThO+9jlnzNAvMkEDP1iHodh1b+oet6sg= X-Received: by 10.98.80.149 with SMTP id g21mr3718620pfj.127.1453463658128; Fri, 22 Jan 2016 03:54:18 -0800 (PST) Received: from localhost.localdomain ([122.166.219.57]) by smtp.gmail.com with ESMTPSA id t70sm9394825pfi.8.2016.01.22.03.54.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Jan 2016 03:54:17 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 22 Jan 2016 17:24:05 +0530 Message-Id: <1453463648-11158-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: Classification patch Cc: petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXT PATCHv1 1/4] api: classification: add pmr create api 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Packet match rule creation is modified to include source and destination class of service. Removes the ability to add any class of service directly with pktio. If a PMR needs to be applied at the pktio level the same should be applied to default class of service. Packet match rule destroy function is updated to removes the link between the source and destination class of service. Signed-off-by: Balasubramanian Manoharan --- include/odp/api/classification.h | 74 +++++++++++++--------------------------- 1 file changed, 24 insertions(+), 50 deletions(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index f46912e..59bd01d 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -50,7 +50,7 @@ extern "C" { /** * @def ODP_PMR_INVAL * Invalid odp_pmr_t value. - * This value is returned from odp_pmr_create() + * This value is returned from odp_cls_pmr_create() * function on failure. */ @@ -286,50 +286,33 @@ typedef struct odp_pmr_match_t { } odp_pmr_match_t; /** - * Create a packet match rule with mask and value + * Create a packet match rule between source and destination class of service. + * This packet matching rule is applied on all packets arriving at the source + * class of service and packets satisfying this PMR are sent to the destination + * class of service. * * @param[in] match packet matching rule definition + * @param[in] src_cos source CoS handle + * @param[in] dst_cos destination CoS handle * * @return Handle of the matching rule * @retval ODP_PMR_INVAL on failure */ -odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match); - +odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t src_cos, + odp_cos_t dst_cos); /** - * Invalidate a packet match rule and vacate its resources + * Function to destroy a packet match rule + * Destroying a PMR removes the link between the source and destination + * class of service and this PMR will no longer be applied for packets arriving + * at the source class of service. All the resource associated with the PMR + * be release but the class of service will remain intact. * * @param[in] pmr_id Identifier of the PMR to be destroyed * * @retval 0 on success * @retval <0 on failure */ -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); +int odp_cls_pmr_destroy(odp_pmr_t pmr_id); /** * Inquire about matching terms supported by the classifier @@ -357,19 +340,24 @@ unsigned odp_pmr_terms_avail(void); * of value match rules, and the application should take care * of inspecting the return value when installing such rules, and perform * appropriate fallback action. + * This is same as odp_cls_pmr_create() except that it creates the link + * using pmr match set instead of a single PMR. * * @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[out] pmr_set_id Returned handle to the composite rule set. + * @param[in] src_cos source CoS handle + * @param[in] dst_cos destination CoS handle * * @return the number of terms elements * that have been successfully mapped to the * underlying platform classification engine * @retval <0 on failure */ -int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms, - odp_pmr_set_t *pmr_set_id); +int odp_cls_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms, + odp_pmr_set_t *pmr_set_id, odp_cos_t src_cos, + odp_cos_t dst_cos); /** * Function to delete a composite packet match rule set @@ -378,7 +366,7 @@ int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms, * same or essentially similar rule-set. * * All of the resources pertaining to the match set associated with the - * class-of-service will be released, but the class-of-service will + * class of service will be released, but the class of service will * remain intact. * * @param[in] pmr_set_id A composite rule-set handle @@ -387,21 +375,7 @@ int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms, * @retval 0 on success * @retval <0 on failure */ -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); +int odp_cls_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id); /** * Assigns a packet pool for a specific class of service.