From patchwork Fri Apr 22 07:18:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 66415 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp563593qge; Fri, 22 Apr 2016 00:19:16 -0700 (PDT) X-Received: by 10.50.92.41 with SMTP id cj9mr2603288igb.38.1461309555910; Fri, 22 Apr 2016 00:19:15 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id ax2si2242691igc.22.2016.04.22.00.19.15; Fri, 22 Apr 2016 00:19:15 -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; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 220F668612; Fri, 22 Apr 2016 07:19:15 +0000 (UTC) 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.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 [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B2AD167428; Fri, 22 Apr 2016 07:19:09 +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 57085685E7; Fri, 22 Apr 2016 07:19:07 +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 30717667D2 for ; Fri, 22 Apr 2016 07:19:06 +0000 (UTC) Received: by mail-pa0-f46.google.com with SMTP id zm5so37213468pac.0 for ; Fri, 22 Apr 2016 00:19:06 -0700 (PDT) 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=f1qVdBtB8f3DDYEqsxNBLXVz/5GOg12fNjrqKFZAzi4=; b=EaJMj6msVCtB0eVihCz9gedq+COCaFuBvhugDoGM4cHt0xtN2RsTGPTG/DqCul05Zt uBY6qQ66S0UuSAfoi34k9QsU1aBGc1RekbQUpSH8fje/o6eKjFdR8mhBeOlA8EETVhVj cJPBQc3FqFWT2izWo8ax1IqAT23Z0NI+u7gsvxQ0wfjefLPw//C9Fc/8hc6IHCvAB8i0 9lAkjdnwugn8ro2LmfgPbUV9/cBl7I1tPbLM5MJQdgWy+SpF32sbuHnHlvGF75phxzZl aVPbtCs6u1wi73xWYfBDlG2VlJYYBfgWzk3aiMo/RtXxHF8AKHqlMhuV/xYi5YVrvUPs q0Tg== X-Gm-Message-State: AOPr4FU8h1cADLbPj2Z6b5dA+cPhfs8IBv1iWuquBaFMD2qd8KtQ3rIVq4VNfwY08RO9dsgIHqc= X-Received: by 10.66.246.228 with SMTP id xz4mr26271783pac.139.1461309545450; Fri, 22 Apr 2016 00:19:05 -0700 (PDT) Received: from bala-Vostro-2520.domain.name ([117.199.134.57]) by smtp.gmail.com with ESMTPSA id fv10sm6987811pad.40.2016.04.22.00.19.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Apr 2016 00:19:04 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 22 Apr 2016 12:48:54 +0530 Message-Id: <1461309534-19648-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: spinney@mellanox.com Subject: [lng-odp] [RFC] api: traffic manager: Proposal for Marking APIs 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" Signed-off-by: Balasubramanian Manoharan --- include/odp/api/spec/traffic_mngr.h | 96 +++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h index e4c15df..a32cf4f 100644 --- a/include/odp/api/spec/traffic_mngr.h +++ b/include/odp/api/spec/traffic_mngr.h @@ -273,6 +273,102 @@ typedef struct { */ typedef void (*odp_tm_egress_fcn_t) (odp_packet_t odp_pkt); +/** Marking APIs + * This Marking functionality entails changes to packet header to reflect the + * color marking of the packet on the port level shaper. This is an optional + * feature and if available on the platform is used to reflect the packet color + * on IPv4/IPv6 DiffServ filed in accordance with RFC 2474. There are three + * different packet marking fields supported they are, + * 1). Assured forwarding in accordance with RFC 2597, the DSCP is marked to + * set the packet Drop precedence in accordance with the color, i.e High Drop + * precedence for RED, Medium Drop precedence for YELLOW and leave the DSCP + * unchangesd if the color is GREEN. + * 2). Explicit Congestion Notification protocol per RFC 3168, where a router + * encountering congestion can notifiy it by setting the lower 2 bits in + * DiffServ field to "11" Congestion Encountered code, which will ultimately + * reduce the transmission rate of the packet sender. + * 3). In IEEE 802.1q VLAN tag header contains a DE - Drop Eligibility bit for + * marking a packet for Downstream switches, and is valid for Ethernet packet + * containing a VLAN tag. + * + * RFC 3168 is only valid for TCP packets whereas RFC 2597 is valid for IPv4/IPv6 + * traffic. + */ + +/** Drop Eligibility + * The odp_tm_drop_eligibility() functions allows one to enable drop + * eligibility for packet based on color, if enabled it will set DE + * bit for VLAN tagged packets. + * + * @param odp_tm Traffic Manager system + * @param color The packet color whose DE bit + * will be modified + * @param drop_eligibility If true then DE bit will be set for + * VLAN tagged packets with this color + * + * @return 0 upon success, < 0 upon failure. + */ +int odp_tm_drop_eligibility(odp_tm_t odp_tm, odp_packet_color_t color, + odp_bool_t drop_eligibility); + +/** Drop Precedence + * The odp_tm_drop_precedence() functions allows one to enable drop + * precedence for packet based on color, if enabled it will set HIGH Drop + * for packets of RED color, MEDIUM drop precedence for packets of YELLOW + * color and the value is unchanged for GREEN color packets. + * + * @param odp_tm Traffic Manager system + * @param color The packet color whose Drop precedence + * is enabled. + * @param drop_precedence If true then Drop precedence level will + * be set according to packet color. + * @return 0 upon success, < 0 upon failure. + */ +int odp_tm_drop_precedence(odp_tm_t odp_tm, odp_packet_color_t color, + odp_bool_t drop_precedence); + +/** Explicit Congestion Notification + * The odp_tm_ecn() functions allows one to enable ECN for packets based on + * color. If enabled will set the lower 2 bits in DiffServ field to "11" + * Congestion Encountered code. + * + * @param odp_tm Traffic Manager system + * @param color The packet color for which ECN will + * be set. + * @param ecn If true then ECN will be set as "11" + * Congestion Encountered code. + * @return 0 upon success, < 0 upon failure. + */ +int odp_tm_ecn(odp_tm_t odp_tm, odp_packet_color_t color, + odp_bool_t ecn); + +/** Vlan Marking. + * + * The odp_tm_vlan__marking() function allows one to configure the TM + * egress so as to have it set the 4-bit VLAN priority field (but only for + * pkts that already carry a VLAN tag) of a pkt based upon the final pkt (or + * shaper?) color assigned to the pkt when it reaches the egress node. When + * enable is false, then the given color no longer modifies the priority + * field. When enable is true then a packet exiting this TM system whose + * color matches the given color parameter will cause the 4-bit VLAN priority + * field to be set to the given priority value. + * + * @param[in] odp_tm Odp_tm is used to identify the TM system + * whose egress behavior is being changed. + * @param[in] color The packet color whose egress marking is + * being changed. + * @param[in] priority_enabled If true then egressed VLAN tagged pkts + * with this color will have the pkt's VLAN + * priority field set to the new_priority + * parameter (below). + * @param[in] new_priority The new VLAN priority value, if enabled + * (see priority_enabled comments above). + * Must be in the range 0..7. + * @param[in] drop_eligible_enabled If true then will set the DEI bit for + * egressed VLAN tagged pkts with this color. + * @return 0 upon success, < 0 upon failure. + */ + /** The tm_egress_kind_e enumeration type is used to indicate the kind of * egress object ("spigot") associated with this TM system. Most of these * kinds are optional - with ODP_TM_EGRESS_PKT_IO being the only mandatory