From patchwork Thu Dec 27 06:23:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 154561 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6605877ljp; Wed, 26 Dec 2018 22:25:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN4YfjYw4+k9B0+PomkZ8+ePOtZWU9yh+5sv/Kl8MollwWHzDN6rRjagv1FUvCQBr3gx9JSh X-Received: by 2002:adf:c108:: with SMTP id r8mr21715025wre.233.1545891946485; Wed, 26 Dec 2018 22:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545891946; cv=none; d=google.com; s=arc-20160816; b=SS6mYeulEbMd9ABCvsFpZUQAUwIlr18MllDRSU6Cp541/+iiVE1dlmr+5iKH91dbhy q10xWiFn5L1podg4GPXFP6KjMhIFK4iVlIQVqvEBBxE0sEggMr6xgR2YeKMi8b0BkAR4 Sb7lOac4okhjSsqqWdj/ClZeOWqEbx7Umfv5lJsghNklPI7WRLwM3WQn1I/YL/m2VaQ+ mZytIpik/NeqleCXsmgHv08/i6GnExcHMg9ViVuL1UzJiQgzk+GIgvSKkJEYWTHl14GR yBkQVmIjLFzYFUX43NovTgZFFYto8A8aDksYD8Kane0wm7T5Xqo09epU7YNoOo87PE2J qKGg== 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:mime-version :content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:cc:to:from :dkim-signature; bh=PC7qI6LRSzcO5yVWHOCM6HvoQY56fuN8Z2Ohmlb8lgs=; b=OpN8kn77u0DJwzhuheq0n4oseCPi2MttJGUnA2RvwadqdkdVxADPUvuNNtgAFG8+7t I79w03hfZxdNGjWj1QzHEhFt4QSSEF4BpbNOfvRDLYtYaSheEy6eBPXlEAaMRAkirC6n QStlZ6Dy3J/C8yZh6JcqrP36JBqYgOT5Oc5QbjCHTr+RbqJvQRcHanIO6luGyQzb3i+i 8By6UbCaJRiZlaC8/SWZnP1CK7WzoTuJ2vw3k45+7WodTvG1qFwcXrS2modHTvG0dsFi /SRI8ys4nhyrmPhpz+pkhI6Lw6DLBdwv7gys18JILRw1/+bZ+WpiyuTbFcLfd9v1L3wE Ae4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=qDkoMi1n; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id y74si17278940wmc.97.2018.12.26.22.25.46; Wed, 26 Dec 2018 22:25:46 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=qDkoMi1n; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A245B5F29; Thu, 27 Dec 2018 07:23:29 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140042.outbound.protection.outlook.com [40.107.14.42]) by dpdk.org (Postfix) with ESMTP id F2FB65A4A for ; Thu, 27 Dec 2018 07:23:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PC7qI6LRSzcO5yVWHOCM6HvoQY56fuN8Z2Ohmlb8lgs=; b=qDkoMi1ngZn2/4lBCQDj3lzVJJBIyf7u1hmAdhnwdjCADOR/s8vHHlBNYJ6W9sm2dss8qamSPm9Oa3BC49A7hmb7++GW81o6zpKBAr/n7ML/2i6LrV2pb8hwZ5VxqTbefbRi3ma5D7Mo8UcQ16Wb+YV9/xOeH2EJLAOoFR6OvQE= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2382.eurprd04.prod.outlook.com (10.169.134.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Thu, 27 Dec 2018 06:23:16 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4%2]) with mapi id 15.20.1471.019; Thu, 27 Dec 2018 06:23:16 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Shreyansh Jain , Nipun Gupta Thread-Topic: [PATCH 16/20] net/dpaa2: add API to support custom hash key Thread-Index: AQHUnaymVO0pGEMYYk2ingFo4fJwPw== Date: Thu, 27 Dec 2018 06:23:15 +0000 Message-ID: <20181227062233.30781-17-hemant.agrawal@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> In-Reply-To: <20181227062233.30781-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.30.134] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BM1PR01CA0120.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::14) To VI1PR0401MB2541.eurprd04.prod.outlook.com (2603:10a6:800:56::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0401MB2382; 6:B6DD1vgtib/0TSlxJFXmM1r2Kl6iTv2Nsoxy6x267nQ8QE9TvYQaOlLsUpGJXa3M4oooKgaBqVZ1kKiUylZkh6+Kd/6tACGktnjIGo07dYreWoAiOWrMdpulvRPittSFHHzm4MxaMYNlUKMWTr0kuAk/HET6EvoAcB/hMSkbnhHikKytSmtAC80l7QNuj7RbGp+psvT9T/7BoXwhZmbsR56OtGpBslc6sxMYchAQlxVIV61d9mz+RaPX7qBMigYPSswegRRETLvv1pBWMgZnYhP29kfAwoRbRwVjjs4m8NnvnyJQykXtLuyYBkVFC97kKHiPNyCDttX2Vyrx+D4UrznMtfJtfATTTDuvm1+Ks1CAGhoMJ4YUZq9XVe2UIgtTQ3e/VBV9RD2qQuoFzG9isv1PVXFnItP9hSqjuzY1uTgGpDYwnGe+9zBnJa1SsT4I1Hqys5XIbnxitFXdNC6zZQ==; 5:TcD0zQ27II007aacvjLwhd1RgJvNUz3ZxojIoTKPivLb0SJ25v8R3Aee1CnLBbrrYG7VUxqCMMvzdp3Y+p3gl6rY4lTOEam/RNnTqpHWjxOSXi1WTg93BjzLwPdT3ln5dS0kVqHgbwNgvW9SLX+vpmx/iBWN4+OSEEG5Th8F9gc=; 7:WfGsoBF5icaZI8k/M/NF5O6S+G7ZoTVSGfWPatF9Nh5sZDtkv51GrevtB4/Wkj9B6Ezw6Bj5EozxyoNz1JOQeQCjyBd9sFBLpnYTAUCUhqY1R6B+b7aBL5dB01L5EAVQ6l+TyITYYykjujl6QFrbvg== x-ms-office365-filtering-correlation-id: acdaccb2-91a4-4750-b7ed-08d66bc3c918 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2382; x-ms-traffictypediagnostic: VI1PR0401MB2382: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(6055026)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:VI1PR0401MB2382; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2382; x-forefront-prvs: 0899B47777 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(376002)(39860400002)(346002)(199004)(189003)(5660300001)(1076003)(26005)(76176011)(186003)(71200400001)(256004)(25786009)(105586002)(4326008)(6436002)(305945005)(11346002)(106356001)(14444005)(446003)(44832011)(476003)(7736002)(55236004)(102836004)(78486014)(486006)(386003)(68736007)(52116002)(86362001)(6506007)(2616005)(71190400001)(66066001)(316002)(54906003)(6116002)(3846002)(2906002)(14454004)(36756003)(99286004)(50226002)(8936002)(1730700003)(81156014)(81166006)(8676002)(6512007)(53936002)(478600001)(97736004)(6486002)(6916009)(5640700003)(2351001)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2382; H:VI1PR0401MB2541.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NeWym7Kp5QBUgCRHvUROGPbra5I8qI0N6+8r8WGzLIq000DfZmpk0PxoKOLu18jXmVgX8rmkHpw0p/6XSaGrt6715+pCAhrdlGAUb/MAhil0t9VOd1fZqoxQUdRkwbrGZjR9xClR+l6SHKlOgMRCuuE/giSOKONVPa5TQ4qNaUu7KzkHh7drhzqO5EYcbyqMUuvFWehn2ZWm89yVYm1thZdr+RmiEXAPIXVlPV26sJ4R97zumtquqjcwqjrGyl6Ckrsl939PDlA0VHgnwZIE5rhbo5VvE8Mp8Oizd9esMzNPwndmQ6GbQ9qgRZTUu4wm spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: acdaccb2-91a4-4750-b7ed-08d66bc3c918 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2018 06:23:15.9107 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2382 Subject: [dpdk-dev] [PATCH 16/20] net/dpaa2: add API to support custom hash key X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Nipun Gupta The DPAA2 hw can support a special offset based configuration to program distribution on hash. This is for all cases, which are not directly supported. e.g. HASH based distribution on inner ip header of a GRE tunnel. Signed-off-by: Nipun Gupta --- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 52 ++++++++++++++++++++- drivers/net/dpaa2/rte_pmd_dpaa2.h | 28 +++++++++++ drivers/net/dpaa2/rte_pmd_dpaa2_version.map | 1 + 3 files changed, 80 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index a6f86df8c..11f14931e 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016 NXP + * Copyright 2016-2018 NXP * */ @@ -28,6 +28,56 @@ dpaa2_distset_to_dpkg_profile_cfg( uint64_t req_dist_set, struct dpkg_profile_cfg *kg_cfg); +int +rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, + uint16_t offset, + uint8_t size) +{ + struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id]; + struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; + struct fsl_mc_io *dpni = priv->hw; + struct dpni_rx_tc_dist_cfg tc_cfg; + struct dpkg_profile_cfg kg_cfg; + void *p_params; + int ret, tc_index = 0; + + p_params = rte_zmalloc( + NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); + if (!p_params) { + DPAA2_PMD_ERR("Unable to allocate flow-dist parameters"); + return -ENOMEM; + } + + kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA; + kg_cfg.extracts[0].extract.from_data.offset = offset; + kg_cfg.extracts[0].extract.from_data.size = size; + kg_cfg.num_extracts = 1; + + ret = dpkg_prepare_key_cfg(&kg_cfg, p_params); + if (ret) { + DPAA2_PMD_ERR("Unable to prepare extract parameters"); + rte_free(p_params); + return ret; + } + + memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg)); + tc_cfg.key_cfg_iova = (size_t)(DPAA2_VADDR_TO_IOVA(p_params)); + tc_cfg.dist_size = eth_dev->data->nb_rx_queues; + tc_cfg.dist_mode = DPNI_DIST_MODE_HASH; + + ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index, + &tc_cfg); + rte_free(p_params); + if (ret) { + DPAA2_PMD_ERR( + "Setting distribution for Rx failed with err: %d", + ret); + return ret; + } + + return 0; +} + int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, uint64_t req_dist_set) diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index 57de27f21..7052d9da9 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -59,4 +59,32 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, struct rte_flow_item *pattern[], struct rte_flow_action *actions[]); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Create a custom hash key on basis of offset of start of packet and size. + * for e.g. if we need GRE packets (non-vlan and without any extra headers) + * to be hashed on basis of inner IP header, we will provide offset as: + * 14 (eth) + 20 (IP) + 4 (GRE) + 12 (Inner Src offset) = 50 and size + * as 8 bytes. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param offset + * Offset from the start of packet which needs to be included to + * calculate hash + * @param size + * Size of the hash input key + * + * @return + * - 0 if successful. + * - Negative in case of failure. + */ +__rte_experimental +int +rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, + uint16_t offset, + uint8_t size); + #endif /* _RTE_PMD_DPAA2_H */ diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map index 1661c5fb5..d1b4cdb23 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map @@ -15,5 +15,6 @@ EXPERIMENTAL { global: rte_pmd_dpaa2_mux_flow_create; + rte_pmd_dpaa2_set_custom_hash; rte_pmd_dpaa2_set_timestamp; } DPDK_17.11;