From patchwork Mon Feb 1 12:55:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 60906 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3054679lbb; Mon, 1 Feb 2016 04:56:32 -0800 (PST) X-Received: by 10.107.18.199 with SMTP id 68mr9384781ios.130.1454331392532; Mon, 01 Feb 2016 04:56:32 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e64si6586285ioe.95.2016.02.01.04.56.31; Mon, 01 Feb 2016 04:56:32 -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 87E2D616CC; Mon, 1 Feb 2016 12:56:31 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=j2owhTyF; 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_H3, RCVD_IN_MSPIKE_WL, 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 8C8ED616B3; Mon, 1 Feb 2016 12:56:26 +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 6814B616B3; Mon, 1 Feb 2016 12:56:24 +0000 (UTC) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by lists.linaro.org (Postfix) with ESMTPS id 26050615EE for ; Mon, 1 Feb 2016 12:56:23 +0000 (UTC) Received: by mail-pa0-f46.google.com with SMTP id uo6so83467768pac.1 for ; Mon, 01 Feb 2016 04:56:23 -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=a5keVXyeHj4shHIrCKm8mp/vSwEeVpcqkSM0iHJ3y5Y=; b=j2owhTyFVabXjLtb7JBP9kyAdBaFMJkTFcF4HhiJAG+88S5TUB/VzUGbyH3c486TFE W16U4ajkB+CbR32Kg36Fz+mxJqT62J07bpzSALTs+dgk1a6vjri+Kn/bWt8Jnf2rc6dj 6ipjJiR/UZ58C6GT2Ly5ijEMOCYko5KogQpE0= 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=a5keVXyeHj4shHIrCKm8mp/vSwEeVpcqkSM0iHJ3y5Y=; b=eV20jNMHPNu5+WIceK2qZ/BjHKTvY9bZYF6dSgLWXu7WCg4sOoILundqSXkr1oTQlL vK6eGNxO/jnYPWYiZSneVEM14QNXew2z2jkr+wj+MMe+IFlZ/jt2i+lYGNZwfRmzsTk7 vvE0NPz6ioQgt6vh1m2O/U1fl/bOfrEGbDgi7YkpPuEJ3dDz8Ghdm4EiUZiEVvGmtq8m zHCaIqzwpw+f6YnvtDuMOY0cB9eKfufTqvvJtYwnjm/6u5+vrIoGlmZ3EBaGZlLKO/dd cB9KNQidZIO1eKQS9tTQrYLON/DizCY8iTiwpSVZBeHiSVQWVjeVy+X3b94MOc/P8yZv WYxg== X-Gm-Message-State: AG10YORtMmIP9dJGI4Fv6kGXb2hU8t29X0fFYqjqU0Afar+AOsfPRsUQIm1Sf/8YuBTTzqxveJM= X-Received: by 10.66.120.200 with SMTP id le8mr38281177pab.61.1454331382494; Mon, 01 Feb 2016 04:56:22 -0800 (PST) Received: from localhost.localdomain ([122.166.219.57]) by smtp.gmail.com with ESMTPSA id y86sm43188805pfa.26.2016.02.01.04.56.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Feb 2016 04:56:21 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Mon, 1 Feb 2016 18:25:57 +0530 Message-Id: <1454331360-16717-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 PATCHv2 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. odp_pmr_match_set_t handle is removed and pmr create function is modified to take number of terms and composite rule is created by providing more than one term. Signed-off-by: Balasubramanian Manoharan --- v2: removes pmr match set include/odp/api/classification.h | 142 ++++++++++----------------------------- 1 file changed, 35 insertions(+), 107 deletions(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index f46912e..263ea7c 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -50,16 +50,11 @@ 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. */ /** - * @def ODP_PMR_SET_INVAL - * Invalid odp_pmr_set_t value. - */ - -/** * class of service packet drop policies */ typedef enum { @@ -286,50 +281,54 @@ 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. + * A composite PMR rule is created when the number of terms in the match rule + * is more than one. The composite rule is considered as matching only if + * the packet satisfies all the terms in Packet Match Rule. + * The underlying platform may not support all or any specific combination + * of value match rules, and the application should take care + * of inspecting the return value when installing such rules, and perform + * appropriate fallback action. * - * @param[in] match packet matching rule definition + * @param[in] num_terms Number of terms in the match rule. + * @param[in] terms Array of odp_pmr_match_t entries, one entry per + * term desired. + * @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 + * @retval Hanlde to the Packet Match 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(int num_terms, const odp_pmr_match_t *terms, + 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. + * Depending on the implementation details, destroying a composite rule + * may not guarantee the availability of hardware resources to create the + * same or essentially similar rule. * * @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); +int odp_cls_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 +/* Return the maximum number of packet matching terms supported for + * a Packet match rule. * - * @retval 0 on success - * @retval <0 on failure + * @param[out] Maximum number of packet matching terms per + * PMR rule. */ -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_num_terms(void); /** * Inquire about matching terms supported by the classifier @@ -346,64 +345,6 @@ unsigned long long odp_pmr_terms_cap(void); unsigned odp_pmr_terms_avail(void); /** - * @typedef odp_pmr_set_t - * An opaque handle to a composite packet match rule-set - */ - -/** - * Create a composite packet match rule in the form of an array of individual - * match rules. - * The underlying platform may not support all or any specific combination - * of value match rules, and the application should take care - * of inspecting the return value when installing such rules, and perform - * appropriate fallback action. - * - * @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. - * - * @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); - -/** - * Function to delete a composite packet match rule set - * Depending on the implementation details, destroying a rule-set - * may not guarantee the availability of hardware resources to create the - * 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 - * remain intact. - * - * @param[in] pmr_set_id A composite rule-set handle - * returned when created. - * - * @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); - -/** * Assigns a packet pool for a specific class of service. * All the packets belonging to the given class of service will * be allocated from the assigned packet pool. @@ -456,19 +397,6 @@ uint64_t odp_cos_to_u64(odp_cos_t hdl); uint64_t odp_pmr_to_u64(odp_pmr_t hdl); /** - * Get printable value for an odp_pmr_set_t - * - * @param hdl odp_pmr_set_t 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_pmr_set_t handle. - */ -uint64_t odp_pmr_set_to_u64(odp_pmr_set_t hdl); - -/** * @} */