From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0051.outbound.protection.outlook.com [104.47.40.51]) by dpdk.org (Postfix) with ESMTP id F2522CF9E for ; Fri, 17 Mar 2017 14:09:18 +0100 (CET) Received: from BN6PR03CA0004.namprd03.prod.outlook.com (10.168.230.142) by CY1PR0301MB1964.namprd03.prod.outlook.com (10.164.1.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Fri, 17 Mar 2017 13:09:17 +0000 Received: from BN1BFFO11FD022.protection.gbl (2a01:111:f400:7c10::1:155) by BN6PR03CA0004.outlook.office365.com (2603:10b6:404:23::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11 via Frontend Transport; Fri, 17 Mar 2017 13:09:16 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.com; dmarc=fail action=none header.from=nxp.com; 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 BN1BFFO11FD022.mail.protection.outlook.com (10.58.144.85) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 17 Mar 2017 13:09:16 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2HD8peT021077; Fri, 17 Mar 2017 06:09:13 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 17 Mar 2017 18:38:29 +0530 Message-ID: <1489756124-10805-8-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> References: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131342297569666569; (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)(336005)(39400400002)(39850400002)(39410400002)(39380400002)(39450400003)(39840400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(2906002)(110136004)(38730400002)(8656002)(50986999)(54906002)(104016004)(76176999)(81156014)(4326008)(50226002)(8936002)(8676002)(81166006)(33646002)(105606002)(5003940100001)(50466002)(106466001)(48376002)(77096006)(85426001)(2351001)(5660300001)(189998001)(86362001)(2950100002)(36756003)(356003)(305945005)(47776003)(6916009)(6666003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1964; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD022; 1:peFxjkIasWZ6i4yxqlcxnwb6Gaj1xqb1/bC63AVJArAIltCnGaOCcQhyQW8B6n1cBT70ebv3pc1roZQ3mxNXWYQgHRT2lUsfvA6M+Tn9q210dLddJZWsKhNpn84MZEzVQfu34CB6TB5gEcRlmc/yLkxUaDGAeI2X1+fiBOZ5TfoVWrb6ttTrynA1eBmc9CkBWMU+IB2izcyqS7kg862Ny8Dn0lLFt+WDtU0NX/mMcigGmG4WydsSAuvq/htu38qhCNLlxeMgDb4CViN1taaT415vjJRNvWIDoGnKJWXNBoFza1W/CURzHWdUdlVcmcCVc3PnaONPoiFONSqh0ghpUYFY1wDq5WO/bI+AYIo4LDox1M14fzQLZVS8pXISUXRN/plvHl/E7PdA7BiORttiic1Pr943VEsIZOeof7L5sQ0whA+gLw1Lr/yE/zBAUvmrGp1qS/gWvV/60kKSYd1zw65WiYsD9+PDJSkpD7UttDjaaLnFfUZ1RmwpVJGfwaANjlg+qMHh/HgAynohk4lnVJVOKJcyxBBSL3t5KQ7ui/LW13G9JzYVD30fssGSWp4fPTTQUca7cKhEI34S7AACVQAR0VfXv9k/cjFYVVLz0X86E0hbojsB07vSHr0wvYck1SFkqWhcpubCPcFWnxPDxw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5d0d4670-bb2d-42d3-44aa-08d46d36d114 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB1964; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 3:SHb2xv0N6rMohECmMVMRWaC6lMon150dNP5SsHBa8pfU+XmSwlaXayPDhde1ajDwjHhfMe6DN7iC0Xu4Xh9G1n/HsnSGBRsAsYc2jl2sBj+O1yvz9lXXFTdFKoaqXKUyYPbyZ77mHeizu5gYzwjqOzfh0Cd5jemjIoQ5Bq2Psm1KCgCYSfis5Z8Tia/BR2x7rqTfVS2Z4cm5HTmm8pZbNkhZfvrdux5wqqF/kFRgjpDxXxS/tCHKZWIbBAkgmkFma78Zsc/6Y/LayoA/crpAv/UEGj7LVKVugGskjdNrK03hd530gWE1oyRYyM65e/gewb6ntxEo8DJ57tCn1fd2QVCFDjuULGRnGMlFKHRogyjaBxssaZWns0yrPwx1TeOZ; 25:7ssO28qMGHkk0rZwJrui3ebrUBy9idfvrHVOfXI1WJznflfXqjAnaMXxtkwcFW0WDC5dzb+B4AO7ZQaplRu/63rbBNweDFCHkU3sdQmjZQyvbihbfhoQ2JnBObrAvAg1h1ke7oO9tjBLUbQ0X0U4gmqZG5AMWOu5hKQMosZpi6zGdaTx/xgU/OuOTHC/d5OjaBp1ahoc2l/mgXjrMYegvuNqCyU83zft12SlhNDTLQRX8+eESx/2NO3+GDhPchzy98TVP+8z4xgex4XSMlRXpc4s0gn+ZXBVpxcTc7dc7LRgfpJ0eIGP1kVBilltDI/ygUibEB+y/uvQoq9kWSXhNX+1WTlyv4VmCEtavColdkr1z9esunjuAOoSpD64BWtgdnJXGLUm31RSLZZTMAepzVxleQSjGngWOLS56ZNzkwpePTVeJL1UpQABHLWCrMQAqvvbtp9/Pq4pmKFBrSizUA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 31:gUC82SgTIK8E9X7C7f6N4yXEvNAcC2ro7ovKKuwLaj/AoePG5EGu92PZL2H3bFx5/CvlScD3RL6pQZDuPn1sCKM+aue1G7j+Up9Nf65WP6iYgCBi9TCLXf784oirGS+By96Al3VpkOCOPTlkDlHXfCtM9rltO3fZWjEaOsG98YIiF8hWA6yWcNIIptco6++GPbOamKZYNcDACJRw+QzAnKxwzYdoXgffXlMi47aOvhb3YdMG/1OaBnNLJCVqJJTMhgme68dv/XKprdeVJwwiRbyAN6BMzztioYiLgaM3ft0= 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)(8121501046)(5005006)(13015025)(13017025)(13024025)(13018025)(13023025)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123563025)(20161123559025)(20161123556025)(20161123565025); SRVR:CY1PR0301MB1964; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1964; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 4:pkWAAJ6vJd/ArNPX1o/bT+sls941xK6L0NnHQl+PcjYU5im81EjJWbHsgMmeSSZCvbDt9U1Ylz6+Zf9K4dJ1iA/zL1wLOJQt/Rmt1k9klJUUUaWexV7BNWI0KoZGH6BNMqUc7csfmO4xkw/q57GbX3Xcl967waueMjD3TcmjKjtu7zFVrvjY2N6sFo3R9b8HbdjalKLuDVsdiVZxmOUgm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?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 6:wApz2tF1vDUr4mbrbUO6aXDGiZC8ehXiar3fyNPfhbSx4nwhkxXmFy7Q4xs3q5AdDQVzXNHidFJb7caYvHoqIMxSjcELN/RyCj5b7+pI8cabYx3oqq8ZMNxLuR/x4kigFBGyhIXvbbcGtWDDiAw1Iys/Ylhk6duRshlLcZm/vvjJurYJ/NSK9OxfVKLgBlpNC09lRFWxVIs3D97vaWVLwdvhmulzMS9Fe8o4PM0blFHKNFrueM+jGoBpHEqc2hwdNGV+RtBq1K4eBArXpXEvF+DIoUQkspRPtBISgJaLDkHBRstyXaZqDoKqEjxx9ny6Uk9CGWMl27uQPxXKtm7MqYbwJNl5RtOV8dAUP9YXMWsTw5HSu8VEbopC5MQWN/77EfUFmgc3wtc0rWahcF5BuOddbCOPiZd9g8Le6GdQQcY=; 5:u4s9FD5q6vi0j0f8b6OBVzkPqoS7FzfLPNK7T68wqewOPf1rDBmqG7GBWlWj151BI+MmQfYRAoi5YEQnjNoZYCp0ZIakP2bBi65ZqfXa2xOPhzZIKwzhwhfxeS+Mb678AVmg38FYoQqyaKvl5kao4jnsgd1E++puS14ZVIvajA0SkE9oyymoIFCUvmyl16sV; 24:nCJNhadDmL0XvGvlLWRwJVomk1m1CpQJPp13Wem5HgKkJuOVgIYlePaJkFlPPvj17ob/SYLKcn6qTJtovxSiHItO1Ul8nOWk2I1S6inhRgI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 7:pfcUqcqUj3S5ytPNqAUc1xI4uY+OmzGhSHQCLbdQkTA+AmSJdJMjedTCdCvV5fy+KwAlg2fFUat46OockuINt8/ibohqtRF2sSb9bmGteZ2q9uC0gUtZfnTr/IdsGbAJCXa3YO29CnciAI9aFHpxFQp3HQvga/nVCadwhtyN12gZZ4UYT16gLGq3NmRBXed5xIEe5/9p1VI+ZeX8uaxgrhRdiL0poVzgZuujdOnOUhipnh4Pp9oVlmquArbVm7DI8BisoxHmyuenTOTrS2B95WZS5KuKeMvmXkKpeCXPcaNnRFviS8A0Lylv6fzwXZycXCKJ2vUN11F9SCiE8laC1g== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 13:09:16.7638 (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: CY1PR0301MB1964 Subject: [dpdk-dev] [PATCH v9 07/22] 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: Fri, 17 Mar 2017 13:09:19 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/Makefile | 1 + drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 287 +++++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 31 +++- drivers/net/dpaa2/dpaa2_ethdev.h | 12 ++ 5 files changed, 328 insertions(+), 4 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 4f78565..b5f3ebb 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -59,6 +59,7 @@ EXPORT_MAP := rte_pmd_dpaa2_version.map # library version LIBABIVER := 1 +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c 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..c95c083 --- /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 +#include + +#include "../dpaa2_ethdev.h" + +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)(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)(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/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index ef826fb..266f70b 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -115,7 +115,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; @@ -141,6 +142,7 @@ { struct rte_eth_dev_data *data = dev->data; struct rte_eth_conf *eth_conf = &data->dev_conf; + int ret; PMD_INIT_FUNC_TRACE(); @@ -152,6 +154,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; } @@ -183,7 +197,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; @@ -373,7 +387,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(); @@ -415,7 +429,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; priv->hw = dpni_dev; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 5f599a7..d24fcc6 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -37,12 +37,16 @@ #include #include +#define MAX_TCS DPNI_MAX_TC #define MAX_RX_QUEUES 16 #define MAX_TX_QUEUES 16 /*default tc to be used for ,congestion, distribution etc configuration. */ #define DPAA2_DEF_TC 0 +/* 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; @@ -53,7 +57,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_ETHDEV_H */ -- 1.9.1