From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0086.outbound.protection.outlook.com [104.47.34.86]) by dpdk.org (Postfix) with ESMTP id 519F15678 for ; Sun, 4 Dec 2016 13:44:33 +0100 (CET) Received: from CY1PR03CA0020.namprd03.prod.outlook.com (10.174.128.30) by BN1PR0301MB0739.namprd03.prod.outlook.com (10.160.78.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Sun, 4 Dec 2016 12:44:31 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::195) by CY1PR03CA0020.outlook.office365.com (2603:10b6:600::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Sun, 4 Dec 2016 12:44:30 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Sun, 4 Dec 2016 12:44:30 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:711; Count:10 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uB4ChXbO032240; Sun, 4 Dec 2016 05:44:27 -0700 From: Hemant Agrawal To: CC: , , , Hemant Agrawal Date: Sun, 4 Dec 2016 23:47:16 +0530 Message-ID: <1480875447-23680-22-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131253290702683592; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(336004)(189002)(199003)(305945005)(2906002)(81156014)(97736004)(68736007)(626004)(50226002)(5660300001)(85426001)(8676002)(76176999)(50986999)(105606002)(110136003)(8936002)(104016004)(2351001)(38730400001)(106466001)(39400400001)(6666003)(189998001)(2950100002)(77096006)(6916009)(356003)(39450400002)(4326007)(33646002)(47776003)(36756003)(5003940100001)(92566002)(39410400001)(39380400001)(50466002)(48376002)(7846002)(8666005)(86362001)(575784001)(81166006)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0739; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD048; 1:7D8VjAJ6FoYpapk08VPpymH/5/T+sS3z2DCWyC+SfQ1SeYj6PUuzp6uaG85BlPBpyfQxY50TyejcEkGmdwuwzHPJAZwyAKrLqU9ql16DziH4Y3WpjByeoNn2RtV4PFo/rH9EZkdgX2NuR5y2N5ARLGRZLCGamQv85JXJ02d1q7Py+dXPcEMSyF2rbe3np9BpnDWijI2n33E3nY2a/KoSsuhihoBaOhFq1TWJ5diNC9zrwK65FuCKTg8cliy3gVHpdTlZYVEDqd09dkNfcw6Dt5gHlA4an6OA2jYNv/HMWQKW9MS5s06TkFPRhvmT4sVEUBbI2712KTJJ0rkw8DG2S0CELFHcHCH4Yx/0iyiexEJEs19DYLnot+EuNxs7vMntFO4Kv7XaQmj3TztWRBmD5oJhsElabPxC3XD/7rGcRyPqPLvVTsX1OSmoqkkuvr2DytDS6O27bwVLzXhUOGc6ifNjY7fv5BtP43nPjFgL4oBG8mo1sO/PSXtNhXpnag0aytx2Dzidt8HH6DMi9CTyE2OJerkc1824qsEmzYhX1csAJv9t6eybdAqwu1HS7FOGC1RwCo1v70l8m+cwIbvv61uG+94SrHum3agQBOmYX1BIU5dcdJSh/0uCjcYRsCs11JGAfE+DxTGBlzx53O6N+lxJoj0CA4TvoxsHnbrMOT/er1iUlB019P2HiPENVAHY6r8RNRQp9S/8s33HKIXY9zo10t/2e2AlJGxeNZ+rudMbYCy3FlkRfyQQYqB45H/FBe2o2MdQ4AXl0LK1OTw2CQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c5d23510-4504-467f-dc6b-08d41c434a63 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0739; 3:zRRVR4JORY84esnmrYTVk+MghzShOD6gnMZAqX4QHquDgN9iB3U9hbyvnF4+N6g+N3kzKPRAGyrDLd1H9P4+qGAM1A9OiwOnNJ3QNldNKo8Qb92GJj8wNKU4xTDWbVOIz2LMBA0DNT5X5SRk6n58qQIya2kx7Doo5oUrWS57cJgen/SXT7bjwVR+tlpPgEccAaQ9bKUvGTlTgRQif6omfrlom7OAQtgJtLhx/vw7kf+obmF7kilgc1wkidwTSoiaMKNTkjou3dqp++c2kgo8/iPaiR2JiXYahgTDokxI1H2pX5D1SIb/oXntnc7HuGuws/Qv7t6qldc59Jo3NVjstxeAf07z3W+V7HLJCF/3wYAv0LgZ9R8aGV9h3tX70S4i; 25:NwzfxgEo1orHdBzU5fOaJUC3Rkr0CwEQfu5XoI+xHvpkgQdbR64Nk5GAbDmLQh3+9EC1IN3eIaaj4zErP0MxDeCaxfK4AgK6RlpvzKK2DGpSj35xvJO9BVDgTsRF46h17t/B6j0z5g/j2NW/LCXDeRjWj1bJwsb3va3NYeouXV2C4gCFwOceIzxy1yKYzeM46eVles31ePzNV/NlL7nE6f5MZWcL2uOsYp8OuoD4R1QBmXmhr9uNljlmcRI5CqLFMgQfzHuPhc5RtYbpQqzSBQCpOqHW8FP97VgKfK0BoOi/5eS9coS+uaT2HZJA2926FKLmoJlfAG/6M24ezeLbbLVzopgd33RBHbcjnuli/R00ZBCnV8m7TEglWClOFlcanoWf4T79yz87PZT8+UMX0uac/SsPtBlr5KqTXBgT637CQh+NOKD2L0v0r1My1lIWEz53rnuipQPWT4A8flunJA== X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0739; 31:sD9D+CBE7Q/Toj0981Bz+Pl4cYXYo5Sff4riFwCC1UF0j3WeR97lxkwMcBw1Eesa4NEHI04ZKGAYD9IvrXs5AKBAaY1fYnVrZYKQWHyMAdgimrfWCZcUd9E5lkxXo30gw+El0e4CJyyH4MnTltcHFbNUvzpM7NSw7CaeAL27SwuisywJHWrkFr9kga3TAd/axJZFQNR9W5Nlmcgpg9JDtGbzp5Q+Pjt2KBj66vw5kjJW0u5yGSwNBqpmGktXQx8sFuBaJqkKkqFiEJgstRhdlw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13017025)(13023025)(13015025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123565025)(20161123559025)(20161123556025)(20161123561025); SRVR:BN1PR0301MB0739; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0739; 4:ZyqyQQSvQhL0R5amAIB0FUY7bbgZmvSGOjSxbvTnnTmfy770VwL9P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ascii?Q?tXZuK1yQdlHPGkxb7jPRiPgV2F83xPmIC74sBkuZ3V1XDPJI96TLkxY+tCd1?= =?us-ascii?Q?MsYfP3PJsmvhqw6vh/6bgKYuullAzM0444ZkMbn78G3qbOfJ4s4IxkGFFBoj?= =?us-ascii?Q?x5lnvik2GQnPcWqNyr38=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0739; 6:PAUgphvp17jAYtS3lSfMJNLu9GSgis6kQ6jkmn3IgEsL2qSuSdIgGzGbQ/iBXapCB1gBQtKHizUXn42GV6y2YAN5xyXm0iFXmlSIFjScBlOoTbDvbSvLp465e7T4KRClzs+aeQ1GdlNa6B/ZVHsZTnoC2pweM8D9X5+1HvJISmL40GloKjhgcCK/gag4ryOrqWVPCqbjs7RxrC6bmnUZ7eKyDG2nFW5p1lJsIcPb/x9brSsTbI2iXiMI/s+5HbDVe+xuod+kQHMJHPtz+R/HykcpA9nAf3tAP56feGAScgygh/DAyQOxmdeeYb2zMU4wuuvbnacXjebkEnON5RXwRArF0V3NXq9Zn9+kgYcMizV/JoldvWmOrWIJUng38Wb7EBEWu2Vhrhl1kMEnc9zTjL3zooHyK6HNNdBLfV7b87SnUvVi7UEqXoxZgNbA6qzb; 5:ILAwf0MTrbJk6yWKjex8SedDzNQwJ6S8aGr4ZcCqYT17fKa85ZrZhVqkYel/N7ibx/pJrwiRG3RMY0CU3fm5RSgUvzM8//74s6jE4iACCINrUncMZ9mbBN4raxvmWdq26tniTGqKikFzxUHBzGRjmdx2P/Grn4nzBSfVEZgh5iEf/DnOrRPhGtuicQeS3Yxx; 24:5ZUlW/koik8MZgeWbEMnK7BRitT+h8siyv+2XPogprqlYjh0FNIrP2lU7GT2Z6yuvOJOLKUB4pePiDao+KJa2fuDXn2ZfxHqnxQz9aNBDEs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0739; 7:vaDlVbNScbLul9JiHp8uhQXaTCmayiM06+nG1GuZKUIFKp0kSb3NW+1RT7VeWI8ScGsItcTZvK5/9Db6TG38Qst5HeRtQDX9lI6282NODZr1Li7o5km0Ax3/A8TFEYYj1vz0BF8AKcJ0Jhz4U95NfTEAdIHh1Utu87qMMBJZbNzojucPB9rXmjqW0ow8bJL95H8wIYWDXK66KdUC6IwY0RsN+NLM3FPvfanJ8sZ4rkb1AG1HO9fqY6eX7yt+7sFc9DJpmpd6QPjobMfQ/5EW6iBljily85QB4oPI03z+Nzrvw4cqx3hPBHvaVGAYExWI1n5AoPpAZ1tNG0XA1iExCu32B0RjKReT6S8v9514fSA5xkCG3RbCtpnV3rBwvCm8HaXKvshFelBlox9wWjGyRG6QGIa6gazrjvTc8vY2V899rI3+/P6SVwBZ3CUZyAdG+wTeqeqyD9nL2aV2derrrg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 12:44:30.0811 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0739 Subject: [dpdk-dev] [PATCH 21/32] net/dpaa2: add rss flow distribution 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: , X-List-Received-Date: Sun, 04 Dec 2016 12:44:34 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/Makefile | 3 +- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 287 +++++++++++++++++++++++++++++++++ drivers/net/dpaa2/base/dpaa2_hw_dpni.h | 15 ++ drivers/net/dpaa2/base/dpaa2_hw_pvt.h | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 31 +++- 6 files changed, 334 insertions(+), 5 deletions(-) create mode 100644 drivers/net/dpaa2/base/dpaa2_hw_dpni.c diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index 0b59725..20152a0 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -5,6 +5,7 @@ ; [Features] Queue start/stop = Y +RSS hash = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index 45e28d2..4ed0de3 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -57,10 +57,11 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpio.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpbp.c +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_vfio.c -# Interfaces with DPDK SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_bus.c +# Interfaces with DPDK SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c # library dependencies diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c new file mode 100644 index 0000000..b26d5a7 --- /dev/null +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -0,0 +1,287 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. + * Copyright (c) 2016 NXP. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Freescale Semiconductor, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dpaa2_logs.h" + +#include +#include + +static void +dpaa2_distset_to_dpkg_profile_cfg( + uint32_t req_dist_set, + struct dpkg_profile_cfg *kg_cfg); + +int +dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, + uint32_t req_dist_set) +{ + 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_malloc( + NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); + if (!p_params) { + RTE_LOG(ERR, PMD, "Memory unavaialble\n"); + return -ENOMEM; + } + memset(p_params, 0, DIST_PARAM_IOVA_SIZE); + memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg)); + + dpaa2_distset_to_dpkg_profile_cfg(req_dist_set, &kg_cfg); + tc_cfg.key_cfg_iova = (uint64_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_prepare_key_cfg(&kg_cfg, p_params); + if (ret) { + RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n"); + rte_free(p_params); + return ret; + } + + ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index, + &tc_cfg); + rte_free(p_params); + if (ret) { + RTE_LOG(ERR, PMD, "Setting distribution for Rx failed with" + " err code: %d\n", ret); + return ret; + } + + return 0; +} + +int dpaa2_remove_flow_dist( + struct rte_eth_dev *eth_dev, + uint8_t tc_index) +{ + 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; + + p_params = rte_malloc( + NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); + if (!p_params) { + RTE_LOG(ERR, PMD, "Memory unavaialble\n"); + return -ENOMEM; + } + memset(p_params, 0, DIST_PARAM_IOVA_SIZE); + memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg)); + + tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params)); + tc_cfg.dist_size = 0; + tc_cfg.dist_mode = DPNI_DIST_MODE_NONE; + + ret = dpni_prepare_key_cfg(&kg_cfg, p_params); + if (ret) { + RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n"); + rte_free(p_params); + return ret; + } + + ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index, + &tc_cfg); + rte_free(p_params); + if (ret) { + RTE_LOG(ERR, PMD, "Setting distribution for Rx failed with" + " err code: %d\n", ret); + return ret; + } + return ret; +} + +static void +dpaa2_distset_to_dpkg_profile_cfg( + uint32_t req_dist_set, + struct dpkg_profile_cfg *kg_cfg) +{ + uint32_t loop = 0, i = 0, dist_field = 0; + int l2_configured = 0, l3_configured = 0; + int l4_configured = 0, sctp_configured = 0; + + memset(kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); + while (req_dist_set) { + if (req_dist_set % 2 != 0) { + dist_field = 1U << loop; + switch (dist_field) { + case ETH_RSS_L2_PAYLOAD: + + if (l2_configured) + break; + l2_configured = 1; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_ETH; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_ETH_TYPE; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + break; + + case ETH_RSS_IPV4: + case ETH_RSS_FRAG_IPV4: + case ETH_RSS_NONFRAG_IPV4_OTHER: + case ETH_RSS_IPV6: + case ETH_RSS_FRAG_IPV6: + case ETH_RSS_NONFRAG_IPV6_OTHER: + case ETH_RSS_IPV6_EX: + + if (l3_configured) + break; + l3_configured = 1; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_IP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_IP_SRC; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_IP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_IP_DST; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_IP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_IP_PROTO; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + kg_cfg->num_extracts++; + i++; + break; + + case ETH_RSS_NONFRAG_IPV4_TCP: + case ETH_RSS_NONFRAG_IPV6_TCP: + case ETH_RSS_NONFRAG_IPV4_UDP: + case ETH_RSS_NONFRAG_IPV6_UDP: + case ETH_RSS_IPV6_TCP_EX: + case ETH_RSS_IPV6_UDP_EX: + + if (l4_configured) + break; + l4_configured = 1; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_TCP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_TCP_PORT_SRC; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_TCP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_TCP_PORT_SRC; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + break; + + case ETH_RSS_NONFRAG_IPV4_SCTP: + case ETH_RSS_NONFRAG_IPV6_SCTP: + + if (sctp_configured) + break; + sctp_configured = 1; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_SCTP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_SCTP_PORT_SRC; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_SCTP; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_SCTP_PORT_DST; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + break; + + default: + PMD_DRV_LOG(WARNING, "Bad flow distribution" + " option %x\n", dist_field); + } + } + req_dist_set = req_dist_set >> 1; + loop++; + } + kg_cfg->num_extracts = i; +} diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.h b/drivers/net/dpaa2/base/dpaa2_hw_dpni.h index 197fd28..c109396 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.h +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.h @@ -37,15 +37,22 @@ #include #include +#define MAX_TCS DPNI_MAX_TC #define MAX_RX_QUEUES 16 #define MAX_TX_QUEUES 16 +/*! Maximum number of flow distributions per traffic class */ +#define MAX_DIST_PER_TC 16 + /*default tc to be used for ,congestion, distribution etc configuration. */ #define DPAA2_DEF_TC 0 /*! Global MCP list */ extern void *(*mcp_ptr_list); +/* Size of the input SMMU mapped memory required by MC */ +#define DIST_PARAM_IOVA_SIZE 256 + struct dpaa2_dev_priv { void *hw; int32_t hw_id; @@ -56,7 +63,15 @@ struct dpaa2_dev_priv { void *rx_vq[MAX_RX_QUEUES]; void *tx_vq[MAX_TX_QUEUES]; + uint16_t num_dist_per_tc[MAX_TCS]; uint8_t num_tc; uint8_t flags; /*dpaa2 config flags */ }; + +int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, + uint32_t req_dist_set); + +int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev, + uint8_t tc_index); + #endif /* _DPAA2_DPNI_H_ */ diff --git a/drivers/net/dpaa2/base/dpaa2_hw_pvt.h b/drivers/net/dpaa2/base/dpaa2_hw_pvt.h index 867611f..abc70ac 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_pvt.h +++ b/drivers/net/dpaa2/base/dpaa2_hw_pvt.h @@ -93,4 +93,6 @@ struct dpaa2_queue { /*! Global MCP list */ extern void *(*mcp_ptr_list); +#define DPAA2_VADDR_TO_IOVA(_vaddr) (_vaddr) + #endif diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 45c3f8f..094296a 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -113,7 +113,8 @@ } vq_id = 0; - for (dist_idx = 0; dist_idx < priv->nb_rx_queues; dist_idx++) { + for (dist_idx = 0; dist_idx < priv->num_dist_per_tc[DPAA2_DEF_TC]; + dist_idx++) { mcq = (struct dpaa2_queue *)priv->rx_vq[vq_id]; mcq->tc_index = DPAA2_DEF_TC; mcq->flow_id = dist_idx; @@ -139,6 +140,7 @@ { struct rte_eth_dev_data *data = dev->data; struct rte_eth_conf *eth_conf = &data->dev_conf; + int ret; PMD_INIT_FUNC_TRACE(); @@ -150,6 +152,18 @@ return -1; } + if (eth_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) { + /* Return in case number of Rx queues is 1 */ + if (data->nb_rx_queues == 1) + return 0; + ret = dpaa2_setup_flow_dist(dev, + eth_conf->rx_adv_conf.rss_conf.rss_hf); + if (ret) { + PMD_INIT_LOG(ERR, "unable to set flow distribution." + "please check queue config\n"); + return ret; + } + } return 0; } @@ -181,7 +195,7 @@ dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */ /*Get the tc id and flow id from given VQ id*/ - flow_id = rx_queue_id; + flow_id = rx_queue_id % priv->num_dist_per_tc[dpaa2_q->tc_index]; memset(&cfg, 0, sizeof(struct dpni_queue)); options = options | DPNI_QUEUE_OPT_USER_CTX; @@ -371,7 +385,7 @@ struct fsl_mc_io *dpni_dev; struct dpni_attr attr; struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; - int ret, hw_id; + int i, ret, hw_id; PMD_INIT_FUNC_TRACE(); @@ -413,7 +427,16 @@ } priv->num_tc = attr.num_tcs; - priv->nb_rx_queues = attr.num_queues; + for (i = 0; i < attr.num_tcs; i++) { + priv->num_dist_per_tc[i] = attr.num_queues; + break; + } + + /* Distribution is per Tc only, + * so choosing RX queues from default TC only + */ + priv->nb_rx_queues = priv->num_dist_per_tc[DPAA2_DEF_TC]; + priv->nb_tx_queues = attr.num_queues; eth_dev->data->nb_rx_queues = priv->nb_rx_queues; -- 1.9.1