From patchwork Fri Jan 11 11:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155340 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp490433jaa; Fri, 11 Jan 2019 04:01:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN7WI9ZPMn14AiMKqH+DLZZM138VcOhvP3W1kEB6uKdr8ToTFA0dYxpXJa2Gz1h2v0jEPpuV X-Received: by 2002:a5d:558a:: with SMTP id i10mr12725291wrv.287.1547208062403; Fri, 11 Jan 2019 04:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547208062; cv=none; d=google.com; s=arc-20160816; b=Ke2XDCS9Sd1crjrqesJoejLh320+JaL+NEqq2THpAWuQ6lUI5eAY2qHa998sKI86F4 xKneryNQkOBribOJQunMr793aKKYFb7ayJUWZARlx/nZkROjn4AuolMZtyNCzozV7v6/ xeIe/ZXniP+mhNi3IqqCO1L5GqLCwDR2PAzTsKkKwwMx18FiQVTv70rFIxx46NmGGMl8 nHdQPRa27u1puYyh0BLLuFSHOVDP4sz/Dwfl8YKQ3k88RNbD4Ljt4EzUnj4cELwgSd+5 2djP1kStHs/mGLpvURBi08MA25VycuyCBPtuyGEYSDybuiLMguWXXcLVQcr7Rw89YkqJ 3NPQ== 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=dofFfIDuhukCwESwAiohsNUgVMO8TV+XrvImo98Haud5B63Kz5ZsPd9Sa3HOZ4YanY 3szGLCHIvbXJ/d6+6+tvHCKHVlvuqJFQBnZ5sp5bJf3WHUVKKCxxajKGCb8CIb8TPV8W i2w+aGCkZyJJAomXyhg5eDjEYSIJs0HCwYs3yA+PqaIe2jtMBeFUlQE+8e9FsLnaiLKg SKfdXGDe4370EnMrNwCNfkfc9rovo6JIosCctWmFb/mjRlPmj3HlN/MZZ13zD1nPFnzi 6YfG1BCLahetNv7xFPugl+SZYGDLs9Rn6eT3ew1Lqc6UeSuQMKmBYEgETIBs7C7gk3Qt 5w6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=bPsqLhxb; 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 f85si13366429wmf.78.2019.01.11.04.01.02; Fri, 11 Jan 2019 04:01:02 -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=bPsqLhxb; 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 87F701BB3E; Fri, 11 Jan 2019 12:58:47 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140054.outbound.protection.outlook.com [40.107.14.54]) by dpdk.org (Postfix) with ESMTP id 79D7D1BB3E for ; Fri, 11 Jan 2019 12:58:45 +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=bPsqLhxbsUFd7ygP7nNmt73WZfT/XP7OLiNQIpveSB1wDji5Sx6k7fdf0pzf2DpLZGDT2PWWxcT7/nAtGoc2D6V01OZuh0b2F5NtafNgc/vwLJIN344EmmA3uDLFwHnqXRTLyFVCL+zUK0awTd+DVz+7B/8GmAaAAYsn6lOSS1Q= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB2109.eurprd04.prod.outlook.com (10.166.43.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Fri, 11 Jan 2019 11:58:44 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:44 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v2 16/20] net/dpaa2: add API to support custom hash key Thread-Index: AQHUqaUA7zJ/o6F0oku6InmGHOxRuw== Date: Fri, 11 Jan 2019 11:58:44 +0000 Message-ID: <20190111115712.6482-17-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB2109; 6:MjPj/mxsaXgA72ebfficEcSuwof1aTatC10mbr6J8FqPT6NqHDSXrXonivMRYvl3YjelcD/aU0ETluFFqYiNyysa7aoA/Npv0LlB1Ez45hjw3zDYn14++poQncM2Ltc/GSlf9UyTwduJm4Um1Bltk9jX1o1sKQcKovjVlcBHIq3cVzMe41TKyLt+YeLmDTnaZ5EhS6dJcWI1lvJtoS3G+YtQJ00gF65ogGOAiAvsRjLCvYqF6FDcN/TcmvgsldW9E2rost2XsrBBsUM53INokRtys9noDyDLa8pSbtdxtd/ETPiNP2m7f5KCTI2c1V4hUqwqs0/YymfWSxM3TohGR7mz0fHAgIzR9ktk4jp3RL2SmqClwWSggKZleqUM2lksfDdve9uXrrUtXNGEY4LTOxCFKR/2WJV792N2FIJIdoBYCdIYYNck4lX3PCNYczAYiHwMc9uDTRNkChfgMgJPTg==; 5:t3JJFmu/SDsG+YW9YyMRs+M3Px08NE3wQ3f28bjLP9MeegWx3jYaTVixmID4Zgp6uCXExUqTvyguiD6Jif/uE2oy0HR3NF8JlHFtFvlpRewhZz4wWIn+FC4PQkJ1tNA21FHC3b0MPb36uNeG3uHeRlQJrtg64HtrbdFMlB0/weuuxwBgShll7FqXImkOZLmtlJ+8r5FNJZ51KA7vinGXAA==; 7:hIYe/clpNmr3OB9DRHYD3Py0WeJLv5VZrUcZDatilA4zIery0d+7mI0eQKIRpp74xanwk3VZciv0vRP8WttrfuvBuqnZhEdC/MnH4T37qtbVGYMiGAsETtPJ5KwnWiOKCK9O8HElTHL7XSCpZtG3gA== x-ms-office365-filtering-correlation-id: 8b43390d-594f-47be-6956-08d677bc2283 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB2109; x-ms-traffictypediagnostic: VI1PR04MB2109: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(99286004)(2501003)(78486014)(6512007)(26005)(316002)(68736007)(186003)(25786009)(36756003)(478600001)(305945005)(14454004)(71200400001)(6916009)(6486002)(71190400001)(2351001)(6436002)(81156014)(81166006)(1730700003)(52116002)(53936002)(76176011)(1076003)(14444005)(256004)(105586002)(8936002)(476003)(54906003)(5640700003)(7736002)(2616005)(106356001)(50226002)(3846002)(6116002)(55236004)(386003)(2906002)(6506007)(11346002)(102836004)(86362001)(446003)(486006)(97736004)(44832011)(5660300001)(8676002)(4326008)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB2109; H:VI1PR04MB4688.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: eFYOhd92sKsWkoLqe1TEeG+TG2mFHPWkv+5/jhhZfaD6/FadXAgJh0CyEMnDt3Mmmd3gtTEHdS9MaJZF2Q72VPP+Ywsi2ScBFmCleRw5ZTZApm6Qe5RXhjN1/n8Td8MfYD4N0d7Mb4vXB3cdNpmX+e2k1u06i1r7sjBId2prYYYhq2w5hpys2wAmpKE8HAUGpHM86X+FnRxCg3LxCMK5st6jftUXLkWgdFJ5JRWs9KuX03XzUnLLlPfwk8syzhYeom3OWmc01dnvKbYavgyrXVA8yaMIMggmwEwLssfqTon1/cHYGgCUSmumIExX61x+10zEAGJDSZpthHtUBFp2upUV9zXn8XmS4iYEhuhBBBks3/GQ9E1YJFyE+XlevYfA79H46YlvQqWltDBmimjWnXTtZshcLhgrEQa4tbNL9WU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b43390d-594f-47be-6956-08d677bc2283 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:41.3092 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2109 Subject: [dpdk-dev] [PATCH v2 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;