From patchwork Fri Jul 14 09:12:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 107739 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp634906qge; Fri, 14 Jul 2017 02:12:26 -0700 (PDT) X-Received: by 10.237.51.3 with SMTP id u3mr10249209qtd.155.1500023546252; Fri, 14 Jul 2017 02:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500023546; cv=none; d=google.com; s=arc-20160816; b=uYW4enGndWF8RsT7dANCo4ILJgQWCkRPBfPiVikqz8AxYbSdvMoiGKvz0FMWt4PDMn xMO+vJEUejTkWgQABHBbz6vm4aediujeoBqpruz75Ie9ECWK9DJ34Zku3XzSjSvakwHE u2F7R3KAyLBJFEsweh3j8g2aZaxwtsR2w3LN4JUaqHDyO42pZd9fGsjtrbK5EPOtgI5n ct1uqaIEsim1Ww3x4cH9K1HPrIP9kYN+omFEq0RLIVNz9fd/iyiPMqxBO8P1G1qc/T0b DYCUhKz690e4aKFhpvSedPmFxMq9LBnp//DbXOS7A26RznfZmJgOOgOxCQKUvtnQDewo 3RfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :delivered-to:arc-authentication-results; bh=LRPD9Q+DOdGH+il+1U0MIaNadufGfhtpsJuoM1GiaL8=; b=Y6ITizEiE5jIr3nGtXMOZO7bZe+SJ5ppL9/H590TPFgJ3MUPapeiPsayJTDv/hVDyM tyJGZ4suYEzdTvPYoBq6WeBDwrFRWP+pHaBX2ueGL5xclIksHz1BKGY/xYtO6QaEe4wT 2mUuch96wZP9gsBlOTxum5qhAtL4CWPYNzfCXVuFOrwb63xYSeeEpvnDvLMhCiWklfnt knFGrA1ZuF01TwZNfJg4LJlPfBZ/Ca0HfBOCp4nH+vJ+bJXJukZSR8JAOdMAYf08NsPg up4Bhbn453vxI3RZjEAS/yeJhgJmIBLWY7sPiFAG3dyJwDNw1joxW8P0/aAdoseNRzxa 4Hew== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 2si7178610qki.248.2017.07.14.02.12.26; Fri, 14 Jul 2017 02:12:26 -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 sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id ECA9965BD3; Fri, 14 Jul 2017 09:12:25 +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=-0.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, 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 4103060B0F; Fri, 14 Jul 2017 09:12:20 +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 646EB60B0E; Fri, 14 Jul 2017 09:12:18 +0000 (UTC) Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) by lists.linaro.org (Postfix) with ESMTPS id 2EFF860B0E for ; Fri, 14 Jul 2017 09:12:17 +0000 (UTC) Received: by mail-pg0-f51.google.com with SMTP id t186so43106581pgb.1 for ; Fri, 14 Jul 2017 02:12:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LRPD9Q+DOdGH+il+1U0MIaNadufGfhtpsJuoM1GiaL8=; b=ejntIco5+q41FhDzPqNgQrYh59S/Wt9PN4C/ShvKsMjIdzF7nDYKMxzduS1cXrmFo9 siVmCGp1ahD1Hm0WElWamCNBl7vMKinh0k4tofkL5ScPmQJ7b6ojcawJhgYwx5jccwpg QPuD7X+2yUsEvlwn2I3JRpTVNe+1h99kojA4m4xHzF6HRT4FohS/nCYj4Be+NbhnKZtG C8+Mk7H3sXgOTt2A4T6iNt0RLN51KuNZQ4J5a7Dwy8v6BpLISXib5v5TaNrhX6Hoc0AF Esnx93PRoxklRAqKlPfkvn+yL5ymIeOVVpwWb4xvN/FbkMllE3dOOOhVvD6bFw9/3Uom +U4Q== X-Gm-Message-State: AIVw110a6/TMnAWIZ7dKDumagGfMSuai/JsF4ldjPA2Dhe34q9GwtfnN KICMAll+i0QLtA9gn9cw1H6k X-Received: by 10.98.178.15 with SMTP id x15mr4226164pfe.75.1500023536211; Fri, 14 Jul 2017 02:12:16 -0700 (PDT) Received: from cavium-desktop.caveonetworks.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id s9sm17381303pfe.67.2017.07.14.02.12.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 02:12:15 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 14 Jul 2017 14:42:08 +0530 Message-Id: <1500023530-29025-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 Subject: [lng-odp] [RFC/API-NEXTv3 1/3] api: classification: add support for packet hashing in classification 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Enable packet hashing per CoS to be able to distribute incoming packets to multiple queues linked with a CoS. Signed-off-by: Balasubramanian Manoharan --- include/odp/api/spec/classification.h | 96 +++++++++++++++++++++++++++++++-- include/odp/api/spec/packet_io.h | 21 ++++++++ 2 files changed, 112 insertions(+), 5 deletions(-) -- 1.7.9.5 diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 39831b2..d31965e 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -19,12 +18,13 @@ extern "C" { #endif +#include +#include /** @defgroup odp_classification ODP CLASSIFICATION * Classification operations. * @{ */ - /** * @typedef odp_cos_t * ODP Class of service handle @@ -126,6 +126,19 @@ typedef struct odp_cls_capability_t { /** Maximum number of CoS supported */ unsigned max_cos; + /* support mode for plain queue */ + odp_support_t plain_queue; + + /* support mode for sched queue */ + odp_support_t sched_queue; + + /** Maximun number of queue supported per CoS + * if the value is 1, then hashing is not supported*/ + unsigned max_queue_supported; + + /** Protocol header combination supported for Hashing */ + odp_pktin_hash_proto_t hash_supported; + /** A Boolean to denote support of PMR range */ odp_bool_t pmr_range_supported; } odp_cls_capability_t; @@ -164,9 +177,40 @@ typedef enum { * Used to communicate class of service creation options */ typedef struct odp_cls_cos_param { - odp_queue_t queue; /**< Queue associated with CoS */ - odp_pool_t pool; /**< Pool associated with CoS */ - odp_cls_drop_t drop_policy; /**< Drop policy associated with CoS */ + /* Number of queues to be linked to this CoS. + * If the number is greater than 1 then hashing has to be + * configured. If number is equal to 1 then hashing is disabled + * and queue has to be configured by the application. + * When hashing is enabled the queues are created by the implementation + * then application need not configure any queue to this CoS. + * Depening on the implementation this number might be rounded-off to + * nearest supported value (e.g power of 2) + * */ + uint32_t num_queue; + + /** Queue type */ + odp_queue_type_t queue_type; + + /** ODP Queue dequeue mode + * This value is valid only for PLAIN queue types */ + odp_queue_op_mode_t deq_mode; + + /** Schedule parameters for the queue created */ + odp_schedule_param_t sched_param; + + /* Protocol header fields which are included in packet input + * hash calculation */ + odp_hash_proto_t hash_proto; + + /* If hashing is disabled, then application has to configure + * this queue and packets are delivered to this queue */ + odp_queue_t queue; + + /* Pool associated with CoS */ + odp_pool_t pool; + + /* Drop policy associated with CoS */ + odp_cls_drop_t drop_policy; } odp_cls_cos_param_t; /** @@ -209,6 +253,23 @@ int odp_cls_capability(odp_cls_capability_t *capability); odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param); /** + * Queue hash result + * Returns the queue within a CoS in which a particular packet will be enqueued + * based on the packet parameters and hash protocol field configured with the + * class of service. + * + * @param cos class of service + * @param packet Packet handle + * + * @retval Returns the queue handle on which this packet will be + * enqueued. + * @retval ODP_QUEUE_INVALID for error case + * + * @note The packet has to be updated with valid header pointers L2, L3 and L4. + */ +odp_queue_t odp_queue_hash_result(odp_cos_t cos, odp_packet_t packet); + +/** * Discard a class-of-service along with all its associated resources * * @param[in] cos_id class-of-service instance. @@ -245,6 +306,31 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id); odp_queue_t odp_cos_queue(odp_cos_t cos_id); /** + * Get the number of queues linked with the specific class-of-service + * + * @param cos_id class-of-service instance. + * + * @return Number of queues linked with the class-of-service. + */ +uint32_t odp_cos_num_queue(odp_cos_t cos_id); + +/** + * Get the list of queue associated with the specific class-of-service + * + * @param[in] cos_id class-of-service instance. + * + * @param[out] queue Array of queue handles associated + * with the class-of-service. + * + * @param[in] num Maximum number of queue handles to output. + * + * @return Number of queues linked with CoS + * @retval <0 on failure + */ +uint32_t odp_cos_queue_multi(odp_cos_t cos_id, + odp_queue_t queue[], uint32_t num); + +/** * Assign packet drop policy for specific class-of-service * * @param[in] cos_id class-of-service instance. diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 8802089..1a40a1f 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -131,6 +131,27 @@ typedef union odp_pktin_hash_proto_t { } odp_pktin_hash_proto_t; /** + * Packet hash protocols + * + * The list of protocol header field combination in enum format, which are + * included in packet hash calculation. + */ +typedef enum odp_hash_proto_t { + /** IPv4 address and UDP port numbers */ + ODP_HASH_PROTO_IPV4_UDP, + /** IPv4 addresses and TCP port numbers */ + ODP_HASH_PROTO_IPV4_TCP, + /** IPv4 addresses */ + ODP_HASH_PROTO_IPV4, + /** IPv6 addresses and UDP port numbers */ + ODP_HASH_PROTO_IPV6_UDP, + /** IPv6 addresses and TCP port numbers */ + ODP_HASH_PROTO_IPV6_TCP, + /** IPv6 addresses */ + ODP_HASH_PROTO_IPV6 +} odp_hash_proto_t; + +/** * Packet IO operation mode */ typedef enum odp_pktio_op_mode_t {