From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0066.outbound.protection.outlook.com [104.47.41.66]) by dpdk.org (Postfix) with ESMTP id 8C573FA85 for ; Mon, 19 Dec 2016 16:21:43 +0100 (CET) Received: from DM5PR03CA0010.namprd03.prod.outlook.com (10.175.104.20) by CY1PR0301MB0748.namprd03.prod.outlook.com (10.160.159.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Mon, 19 Dec 2016 15:21:41 +0000 Received: from BN1AFFO11FD036.protection.gbl (2a01:111:f400:7c10::130) by DM5PR03CA0010.outlook.office365.com (2603:10b6:3:118::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Mon, 19 Dec 2016 15:21:41 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD036.mail.protection.outlook.com (10.58.52.240) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 19 Dec 2016 15:21:41 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBJFKMhj029110; Mon, 19 Dec 2016 08:21:37 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Tue, 20 Dec 2016 02:23:59 +0530 Message-ID: <1482180853-18823-21-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266345014303581; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39410400002)(39850400002)(39400400002)(39380400002)(39450400003)(39840400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(38730400001)(81156014)(8676002)(50226002)(8936002)(69596002)(33646002)(626004)(5660300001)(6666003)(6916009)(2950100002)(47776003)(110136003)(92566002)(2906002)(85426001)(97736004)(104016004)(5003940100001)(189998001)(81166006)(76176999)(50986999)(77096006)(48376002)(86362001)(36756003)(4326007)(50466002)(106466001)(2351001)(68736007)(356003)(8666005)(305945005)(105606002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0748; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD036; 1:7N0xXWSQwzBFV4x1yI5n/n3pykSZyM/j8Ctj9w3HLVFrtZPH6SsMkhl3lg+3CD/WllCGvEu5CG83ROPnDtrqE7VmNVy3XVQNxj4imkUOBFL7lanFVDNHnTmLcV7eSF+IUKHlM5P/DBu69ibLVPHLNal1H0vgKI2uuJIyRH1zpj1m6+aMYqZXEN8/VbYuZBkakw85CjLigqWB6E3TCDuG5gUpniXpUxykbvjq/i4Cuxgz8mAZcA6sgNU2/ojdLo4gTowE8bJaaTMlQun3+vRH2OKht8d8XPJeV3p7CkwXqNv/+SUHfNWDlLNSwClPiCT3pKp4U5LL3yAosKqlOX7auQo4K3dAQNXkHcy1Zzm0oi/s/0+ydKq5V5Hoah2qdGYyOURYTcIGTj09X8g2zzAnnAt47JcsutaQI5HwyyRZg4CwUJ8voFQJVCuxwtP+Wo0+i5bHHh64IsLJPMi0/VNavxLdLImNC+kvFrYZ34EWzmaVFa078owI66GBwSrTuD2AmU84MdnsKCqx2QW8a1WvJWzCuhH2mAY6cO0H0e9IdYCz9oVOhrgTPQguJEQ44HojfPancN6Fu8qWB4Rkn2qQT9XJRg9jWzTq4RcQ4tXWbusduvRzJDDUUZt0QBh8g7hNkpEqLDQh7OqxaVrCB3EQDc2ZdWJHHgoOSlGA1WRqTywJFsL5i1/DRtmqnxpyi3J1LgTHyXnlMSKIxOZbfIRmeMRsylK+mU6w3cClWh6msi6zEnoJ/llz6AolGSQJbH5+CvXkNTsIc+KqjeF0pH8+GA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: db5f02a6-85dc-4340-9b5d-08d42822bc01 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB0748; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0748; 3:pUkjV5NS5dlJjpbAb0h+gA46UO6bITmy8wy6OI8jfBRdqiqQX/9iQ4e5IM4yIBD6i8tP5GtgUJU0yD6sLzk2OZ9q04uibLH+yALNEVrvmu0gadIkeJap5CsKtHg2qjuoxChrO+JdJQJahe9wHnMTf3njdTAnbL6fmP6EZAxcqvzaYGbsgQvIpr0pbWdOyRTEqpyurtCW08HHcyE2WK1ST/OBacJD0DTMIsiv70EzAxHzXJ+zgAaDrejpmPTudNkRJPxnSDMapOnKvmN9+d8QmpKubCl7ro9ecTNV0n0T+LH+ePybn70URiGFjA3G3g9lwtiu2SUjXKQNr2rFTt3ljhB6DQRzJibtA2WhF7DQRfmP39iOfhg9knwHNUf8HXZl; 25:KmJ/hJYIsbfSuHw3vzZp3a29GZhfPFDfEwW73D99qIiLObq+cy6WiovX3OuGp6TCt/6TWHy434F8z4by2iPp69M8b/80Hqsr7LNW087euN8luMucv02RG/v2/JI/9eEOoGG/BfooW2SWwdkU8qTlHkQnZMFxzjVB14PR55vmO0eOitg/bKAtXiYOsVgpUwbG6+PoSMHMy4N0ZvGsEilQ26GmEAuO4BR5ymtKLvhXfdn4guRSL8TEr+BugP0h19RlcZJ3gxhS5wbc26acKdo6cnTGsNxVNo5lowYWNKJQZAAG8zrqfupe+QnYfQnBM1aQ5Vs0Jkf/RbfSAKZ5x1jFzQxvzik/xk6Cvw+ZcjV8zjk4Y4WpzbHJVM/N+D/qNJf6BgPrvjTP0jujuqldAku2GjYgotBbFRJUr7u1BjRya/BwmZt8EmPLHxgUKEbRkkN4MAoC45HeNAiDoTUtQ8ds/Q== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0748; 31:G15ZLjmKRy9MS8P0A5wYeAYPic3TN6T1Z3GImSe0xwbNGsR7Xqdr9IQ+wk+1WFql6U+ZMdpA3VnNOe8MnI0UNK3FHCdn/xMiXoG/ng190ZVa+VbAJjux4eVFjEI/FMUyRCz28YYRS7ALOjOsJ+sOBWuMtaR3yPmVXrfotAOkMkfAOz2e2/pRb2PJf6A23OOGqHddBVSsjzqPa+1IkDqs9FoB1joDHUNssuhT3k97Bviqxsqs13sJID6iZOdqCrp4hTywMRZq05oy0V+lqqFtKA== 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)(13023025)(13024025)(13015025)(13017025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:CY1PR0301MB0748; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0748; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0748; 4:CuhIy/th4gn7iykaY/U/XpFmDc6fmAap6bY9dBz3JFC9TO2/QunVJ8vt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: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0748; 7:+dVQ+pTKWS9wX+djbo3AQ5Nw4YJdPJoakTSWa1r4h7QjNFL7jrfMEYpUW1GS1L6kTuJElIuEjrtlRsCR86QlmfEt5Mm6aV6AcKzmH0zuClcXkdq+JHgRbLv7IE732BaZaOFvlVkM8TTMtH48iySCkmt9iYxSb5Cx40aLelOlKKZhPKKMkIgGK2PzvnzPKjUaEg871FRYLmAzAAHCA/W7jDrSFbDvDsRoa8Vyeq/Fa8UuPCPxpH6FVT1OBuHOPUv6hZYBV7kT7A8+sHG1vlVneEpiQnIZyHWTTK//Nj5/YkGtubDUe+6g7+lLXaNkroK49fksmtO28RYaRYhtO1JxebtFz0d8EGOP2WO/LYSxvVwo6/2UeWWjoBb52hDtba03vO9W7ALmQMyR591Hli0kPfMrzjdT9JlVo4EAeGwsLURn8BU5air/jCS8JzP9Oll/PFkPJmKAtfxloOSqHOvzew== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2016 15:21:41.1963 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0748 Subject: [dpdk-dev] [PATCHv2 20/34] 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: Mon, 19 Dec 2016 15:21:44 -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 4425b76..c331270 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -57,6 +57,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 # 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..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 d511d7b..9066aa5 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -116,7 +116,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; @@ -142,6 +143,7 @@ { struct rte_eth_dev_data *data = dev->data; struct rte_eth_conf *eth_conf = &data->dev_conf; + int ret; PMD_INIT_FUNC_TRACE(); @@ -153,6 +155,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; } @@ -184,7 +198,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; @@ -374,7 +388,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(); @@ -416,7 +430,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; 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