From patchwork Thu Sep 11 18:45:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 37278 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D498120454 for ; Thu, 11 Sep 2014 18:45:56 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id ft15sf42197038pdb.9 for ; Thu, 11 Sep 2014 11:45:56 -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:from:to:date:message-id :mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=Zo1C6sfzkLNObbEVI8LjqYqqCtPQcuTRS37X19Qy6YE=; b=PoJvD+h72X6cXKLiXh3MADxrdW8IVGxVtOxBP+zb2qI9XYMjsgoUWr6y4sZ0Mojew2 JQdPWEUVgLGLI4duJHCQOPkDXQonPfJUr4s6yoMuk6uucpTMaJcNQMRVlpVwyzsX5nKD 4ce7fX6UeC0MSIY65PSGav75zOwKMt/kyChogCR5tK3BcnZtY5TqUVX9Q0erdWv0Uzwl nZsPAHITQ7Sa6ibdzjFSVHQjnjrek/ABDtyKJTRB3UIgvGSta1zOluw4TrbBXPoCeIJ7 wtGGNEJkWONwtYcrBOaG8XECMWr12u3xYmyqmXlebeIcl0JbfNHKskW5UiQV1OsSBgYl 3XQw== X-Gm-Message-State: ALoCoQlvrOqJPXfimo/PNcNZcGu9WB0iakrg2w2fATbvIwBLiZK2jwwW5ms3cGOfplzZaRwLo53p X-Received: by 10.66.227.37 with SMTP id rx5mr1270915pac.25.1410461156161; Thu, 11 Sep 2014 11:45:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.49 with SMTP id 46ls319149qgo.37.gmail; Thu, 11 Sep 2014 11:45:56 -0700 (PDT) X-Received: by 10.221.64.205 with SMTP id xj13mr2439323vcb.18.1410461156020; Thu, 11 Sep 2014 11:45:56 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ui7si1005023vcb.55.2014.09.11.11.45.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Sep 2014 11:45:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id le20so6706992vcb.27 for ; Thu, 11 Sep 2014 11:45:55 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr1946415vdb.25.1410461155816; Thu, 11 Sep 2014 11:45:55 -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.221.45.67 with SMTP id uj3csp635648vcb; Thu, 11 Sep 2014 11:45:55 -0700 (PDT) X-Received: by 10.140.29.161 with SMTP id b30mr2991463qgb.25.1410461155013; Thu, 11 Sep 2014 11:45:55 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id r4si2327912qan.67.2014.09.11.11.45.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Sep 2014 11:45:53 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XS9NP-0001SQ-FS; Thu, 11 Sep 2014 18:45:51 +0000 Received: from mail-oa0-f45.google.com ([209.85.219.45]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XS9NJ-0001SL-Bs for lng-odp@lists.linaro.org; Thu, 11 Sep 2014 18:45:45 +0000 Received: by mail-oa0-f45.google.com with SMTP id m1so569255oag.32 for ; Thu, 11 Sep 2014 11:45:40 -0700 (PDT) X-Received: by 10.60.33.35 with SMTP id o3mr3241049oei.7.1410461139771; Thu, 11 Sep 2014 11:45:39 -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 p10sm1009841obk.2.2014.09.11.11.45.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Sep 2014 11:45:39 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 11 Sep 2014 13:45:31 -0500 Message-Id: <1410461131-5498-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 X-Topics: Architecture patch Subject: [lng-odp] [ARCH/PATCHv2] Fix formatting issues associated with previous commit X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org 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.220.182 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 --- classification_design.dox | 78 ++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/classification_design.dox b/classification_design.dox index 58ffb51..b6a6f24 100644 --- a/classification_design.dox +++ b/classification_design.dox @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, Linaro Limited +/* Copyright (c) 2014, Linaro Limited * All rights reserved * * SPDX-License-Identifier: BSD-3-Clause @@ -19,12 +19,15 @@ Rule Matching, in turn, takes the result of parsing and sorts packets into Class The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc21199). @subsection purpose Purpose ODP is a framework for software-based packet forwarding/filtering applications, and the purpose of the Packet Classifier API is to enable applications to program the platform hardware or software implementation to assist in prioritization, classification and scheduling of each packet, so that the software application can run faster, scale better and adhere to QoS requirements. + The following API abstraction are not modelled after any existing product implementation, but is instead defined in terms of what a typical data-plane application may require from such a platform, without sacrificing simplicity and avoiding ambiguity. Certain terms that are being used within the context of existing products in relation to packet parsing and classification, such as “access lists” are avoided such that not to suggest any relationship between the abstraction used within this API and any particular manner in which they may be implemented in hardware. + These are the key ODP objects that the parser needs to employ, that are presently defined in ODP: @subsubsection odp_pktio odp_pktio odp_pktio specifies an individual packet I/O channel instance. In other words, it would translate to a physical interface or a logical port, or in the case of channelized protocols (e.g., [Interlaken](https://www.google.com/url?q=https%3A%2F%2Fwww.cortina-systems.com%2Fimages%2Fdocuments%2F400023_Interlaken_Technology_White_Paper.pdf&sa=D&sntz=1&usg=AFQjCNEBdJTBmA1XaNGY3pmumQTfgSi1oA)) it would map to a logical channel on that interface. + Since the classifier API deals exclusively with ingress, this object represents the source of packets into the classifier. In order to support any non-trivial use case, the classifier API needs to be able to assign multiple odp_queue instances for any single odp_pktio object, and may also assign any odp_queue instance to more than one odp_pktio object. @subsubsection odp_queue odp_queue @@ -77,9 +80,11 @@ While the above description refers to the abstracted packet classifier, the foll @subsection cos_creation Class of Service Creation and Binding To program the classifier, a class-of-service instance must be created, which will contain the packet filtering resources that it may require. All subsequent calls refer to one or more of these resources. + Each class of service instance must be associated with a single queue or queue group, which will be the destination of all packets matching that particular filter. The queue assignment is implemented as a separate function call such that the queue may be modified at any time, without tearing down the filters that define the class of service. In other words, it is possible to change the destination queue for a class of service defined by its filters quickly and dynamically. + Optionally, on platforms that support multiple packet buffer pools, each class of service may be assigned a different pool such that when buffers are exhausted for one class of service, other classes are not negatively impacted and continue to be processed. @subsection default_packet_handling Default packet handling @@ -121,7 +126,6 @@ The ODP packet API module SHALL provide accessors for retrieving the above meta @subsection data_types Data Types The following data types are referenced in the API descriptions described below. The names are part of the ODP API and MUST be present in any conforming implementation, however the type values shown here are illustrative and implementations SHOULD either use these or substitute their own type values that are appropriate to the underlying platform. -*/ @verbatim /** @@ -244,19 +248,19 @@ This routine associates a target queue group with a CoS such that all packets as int odp_cos_set_pool(odp_cos_t cos_id, odp_buffer_pool_t pool_id); @endverbatim -This OPTIONAL routine associates a target buffer pool with a CoS such that all packets assigned to this CoS will be stored in packet buffers allocated from the designated pool_id. +This routine associates a target buffer pool with a CoS such that all packets assigned to this CoS will be stored in packet buffers allocated from the designated pool_id. @subsection cos_drop_policy Class of Service Drop Policy Routines These routines control how drop policies are to be observed for a given class of service. @subsubsection drop_data_types Data types -~~~~~{.c} +@verbatim enum odp_cos_drop_e { ODP_COS_DROP_POOL, /**< Follow buffer pool drop policy */ ODP_COS_DROP_NEVER, /**< Never drop, ignoring buffer pool policy */ }; typedef enum odp_drop_e odp_drop_t; -~~~~~ +@endverbatim @subsubsection cos_set_drop odp_cos_set_drop @verbatim @@ -311,7 +315,7 @@ Incoming packets on the specified pktio are assigned to this class of service if int odp_pktio_set_error_cos(odp_pktio_t pktio_in, odp_cos_t error_cos); @endverbatim -This OPTIONAL function assigns a class-of-service used to handle packets containing various types of errors. +This function assigns a class-of-service used to handle packets containing various types of errors. The specific errors types include L2 FCS and optionally L3/L4 checksum errors, malformed headers, etc., depending on platform capabilities. The specified error_cos MAY simply discard these packets or deliver them via a queue to the application for further processing. @subsubsection pktio_set_skip odp_pktio_set_skip @@ -328,7 +332,7 @@ The specified error_cos MAY simply discard these packets or deliver them via a q int odp_pktio_set_skip(odp_pktio_t pktio_in, size_t offset); @endverbatim -This OPTIONAL function applies to ports that carry an additional headers preceding the standard Ethernet header. +This function applies to ports that carry an additional headers preceding the standard Ethernet header. Such headers are typically vendor-specific and thus the classifier is not required to parse such headers, but the size of a custom header is critical for the classifier to be able to parse standard protocol headers that normally follow. @subsubsection cos_set_headroom odp_cos_set_headroom @verbatim @@ -347,7 +351,7 @@ Such headers are typically vendor-specific and thus the classifier is not requir int odp_cos_set_headroom(odp_cos_t cos_id, size_t req_room); @endverbatim -This OPTIONAL routine specifies the number of bytes of headroom that should be reserved for each packet assigned to this class of service. +This routine specifies the number of bytes of headroom that should be reserved for each packet assigned to this class of service. Each implementation defines an ODP_PACKET_MAX_HEADROOM limit that sets an upper bound on the size of the headroom that can be reserved for a packet. @subsubsection cos_with_l2_priority odp_cos_with_l2_priority @verbatim @@ -385,10 +389,10 @@ For each of the values in qos_table[], the corresponding value in cos_table[] wi * @return 0 on success negative error code on failure. */ -int odp_cos_with_l3_qos(odp_pktio_t pktio_in, +int odp_cos_with_l3_dscp(odp_pktio_t pktio_in, size_t num_qos, uint8_t qos_table[], /**< 'num_qos' elements */ - odp_cos_t cos_table[], /**< 'num_qos' elements */ + odp_cos_t cos_table[], /**< 'num_qos' elements */ odp_bool_t l3_preference); @endverbatim @@ -429,7 +433,7 @@ enum odp_cos_hdr_flow_fields_e { Conforming ODP implementations SHOULD implement efficient flow set management routines such as these: -~~~~~{.c} +@verbatim /** * Set of header fields that take part in flow signature hash calculation: * bit positions per 'odp_cos_hdr_flow_fields_e' enumeration. @@ -457,7 +461,7 @@ odp_cos_flow_is_set( odp_cos_flow_set_t set, { return (set & (1U << field)) != 0; } -~~~~~ +@endverbatim These routines are intended to be used in support of the following flow signature APIs: @@ -480,7 +484,7 @@ odp_cos_class_flow_signature(odp_cos_t cos_id, odp_cos_flow_set_t req_data_set); @endverbatim -This OPTIONAL routine associates a fow set with a class of service for flow signature calculation. +This OPTIONAL routine associates a flow set with a class of service for flow signature calculation. @subsubsection cos_port_flow_sig odp_cos_port_flow_signature @verbatim @@ -501,21 +505,23 @@ odp_cos_port_flow_signature(odp_pktio_t pktio_in, odp_cos_flow_set_t req_data_set); @endverbatim +This routine associates a flow set with an input port for flow signature claculation. + @subsection pmr_routines Pattern Matching Rules Routines The following data structures SHOULD be implemented to support the definition of pattern matching routines by conforming ODP implementations: -~~~~~{.c} +@verbatim /** * PMR - Packet Matching Rule * Up to 32 bit of ternary matching of one of the available header fields - * + */ #define ODP_PMR_INVAL ((odp_pmr_t)NULL) typedef struct odp_pmr_s *odp_pmr_t; -~~~~~ +@endverbatim -@subsecion terms Terms +@subsection terms Terms Terms are the elements of a PMR and are identified by the following enum: @verbatim @@ -737,24 +743,24 @@ Note that some implementations MAY be able to implement tables directly while ot */ typedef struct odp_pmr_match_t { - enum odp_pmr_match_type_e { - ODP_PMR_MASK, /**< Match a masked set of bits */ - ODP_PMR_RANGE, /**< Match an integer range */ - } match_type; - union { - struct { - enum odp_pmr_term_e term; - const void *val; - const void *mask; - unsigned int val_sz; - } mask; /**< Match a masked set of bits */ - struct { - enum odp_pmr_term_e term; - const void *val1; - const void *val2; - unsigned int val_sz; - } range; /**< Match an integer range */ - }; + enum odp_pmr_match_type_e { + ODP_PMR_MASK, /**< Match a masked set of bits */ + ODP_PMR_RANGE, /**< Match an integer range */ + } match_type; + union { + struct { + enum odp_pmr_term_e term; + const void *val; + const void *mask; + unsigned int val_sz; + } mask; /**< Match a masked set of bits */ + struct { + enum odp_pmr_term_e term; + const void *val1; + const void *val2; + unsigned int val_sz; + } range; /**< Match an integer range */ + }; } odp_pmr_match_t; @@ -851,6 +857,7 @@ In such an implementation, the classifier will be able to associate a packet alr If however the selected pool counter has already reached a certain limit, the classifier would be able to e.g discard the packet instead of incrementing the destination pool counter, and thereby enforce the desirable semantics of distinct buffer pools per class of service. Other possible action that may be taken in response to running out of buffers or coming too low on buffers include back-pressure and random-early-detect with a discard probability inversely proportional to the number of free buffers in a pool. + A related implementation topic is the ability to begin dropping some packets before a buffer pool is entirely exhausted. This is typically referred to as Random Early Detect (or “RED”). This is deemed to be a feature of the buffer pool implementation on a given platform, where in addition to a hard limit on the number of buffers that can be allocated to a pool, there can also be an option discard packets with a probability the increases as the number of outstanding buffers approaches that hard limit. @@ -885,6 +892,7 @@ int odp_pktio_set_headroom(odp_pktio_t port_id, unsigned req_bytes); @endverbatim The return value should be negative if the request can not be satisfied, or positive otherwise indicating the actual minimum headroom reserved. Note that the implementation may reserve more than the requested amount of headroom, and hence on platforms that are unable to support per-port (or per CoS) headroom configuration, a system-wide headroom configuration may be set to the largest of all such requests, and thus satisfy the requirement. + In addition to the above per-port headroom configuration call, there should be an optional, per-CoS call that allows the reservation of different amounts of packet buffer headroom for packets that match certain criteria: for example, the following call allows the application to request that only packets that are expected to be encapsulated in a tunnel, be augmented with a large headroom amount, while packets that are received from a tunnel, and are IP fragments, be assigned a different headroom requirement (see definition for odp_cos_set_headroom() above). @subsection open_issues Open Issues