From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by dpdk.org (Postfix) with ESMTP id DA7ACD0B2 for ; Tue, 11 Apr 2017 15:50:14 +0200 (CEST) Received: from BN6PR03CA0025.namprd03.prod.outlook.com (10.175.124.11) by BLUPR03MB245.namprd03.prod.outlook.com (10.255.213.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Tue, 11 Apr 2017 13:50:13 +0000 Received: from BN1AFFO11FD014.protection.gbl (2a01:111:f400:7c10::114) by BN6PR03CA0025.outlook.office365.com (2603:10b6:404:10c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10 via Frontend Transport; Tue, 11 Apr 2017 13:50:12 +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 BN1AFFO11FD014.mail.protection.outlook.com (10.58.52.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Tue, 11 Apr 2017 13:50:12 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v3BDnjFu000706; Tue, 11 Apr 2017 06:50:09 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Tue, 11 Apr 2017 19:19:23 +0530 Message-ID: <1491918578-4902-8-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> References: <1491725483-6619-1-git-send-email-hemant.agrawal@nxp.com> <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131363922128964744; (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)(39450400003)(39400400002)(39850400002)(39380400002)(39410400002)(39840400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(2950100002)(356003)(50226002)(110136004)(38730400002)(5003940100001)(97736004)(4326008)(77096006)(86362001)(54906002)(6666003)(53936002)(6916009)(8676002)(85426001)(81166006)(104016004)(8936002)(189998001)(2906002)(8656002)(36756003)(50986999)(47776003)(305945005)(5660300001)(76176999)(106466001)(2351001)(50466002)(105606002)(33646002)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB245; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD014; 1:VKlLGxzVPiHT2RxvzfH/ZFx0LAwg1uWGcLaZnhdPBpW4fLcCdi+mjEo4Grl5wD38PiqrFWv6Wjzz1j8PH3DnGDHTsz0DJEDdZuzZccXe6nT1aBWmcEPqNwFzbcRByg+W8Yf6ldrB1ElfIx0Cq8l0jH3auT0I7v8MzLrZH608SEZ3SVkiq/ZnJKIm9M7l11RRdRFsCChp5mGfaDFhVs1s2+P6xD23kXsPyaRCQZX0tpSHdYAJZZOYuVUbks1CCcTdshTUmU0m+jSvgO0Qf2ftikn6fUNab94omdSi8WwEX2HlFCIuLqcHZmYMl9AHSnsgTuI4+gd8NxfEWHtXpIoKh64w+3V2NwhO8ffSvFj47YIX9Azw+4ug1Jb+KgIj0gaHgu1ugcoQzVvp+ILM+FvUio+RYZJvSRPUvF1XXmQl3Gx5VVIRfeIt5rhmM9vajKswnRDq4X0dJmhwHwr4Y6l/QFJ9X5ozLUKCX++HlG/Wv40qm0/WJ16um3pKAi+8XOSibBxJHfEVu19UZ5YnWXGtcb/6dbxBAyTY9riYZ8oUusZ77/aLGU+EpUQm1j8YCZ8wnOWHxJz5ncHweEJJcJkiC91iPCc643zHEvSDkqByDLT2FbuR7SHl6EIhhbrdLGZ/NDY1/7IsWWM5RU133iiU1I0s9/nOl2inRu9Rv0659YI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d9fff582-8bae-4a72-2b29-08d480e1ad41 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030255120)(201703131430075)(201703131517081); SRVR:BLUPR03MB245; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB245; 3:wiqklWHxENmNZQwvmE1vS9ZcKKwG1MGO67DuZC0eRwoYe3sUGga4jD/C+Smnrw49Y91ACDmf6kDn8EB9kg0StDL7CFtbD69PBvXRhYqhx9L+8nkonUlnDE9MCVoRaX4oY6WiQqlB80lOkcDYNvFxUx4Hjol1z+Dvil1yDXjXmWBECvhnqInNnIYaEG/yb338MVeEj6KsKvaWSDeoFeWkJRMDDR1e9f1Bd8GseiHieoiJafXgT4bcu2TNUjN3BcjRmEiJkPo/VHKHJ9swWeyTrqj+2v4O+Lsk8VWfdok73qDN8yIInhkBOcnw6GRSntg2UC+wECFuVYVZLuHEEqZa3KUrlpQhu7GziMJAVl2GvTWC+L9bIPEnjaWMir1HfdQd+NW/B00iSGEBxSnVDVQGynw+SLF7vYgT0afElsT1kXXVaeEpN1CKPBP8lQGqITY/cH3nQl3sTl1f3ASDwpAyvA==; 25:B0KFIwJMlzkQiiQ5/DhiR62PJGGFEfS4cKLkesBHIubZsYtbaOJZF8X27vBG7uScRTZUZJCUKyF0R7Oo5W2Q3ZzFfKDcuFvGkaiiDw5Vw0O9uzJmqmRRbmtZQ54S5xCRJxF7BR8yt0d9jtBL5E/mMSvgoirzkELxXZVtPnFmDBjTeWN4qOjPS4YAoFxByHHOi0J6/5OSeTKD+COXrd8ZQ6K+kDHGxGH7xgGEUL74251+/MdM+9IDyPuafIe4QfOk5OL+BGGHNlvw8oErdDBg95XmReV4xZ0DIkgZPmqi4Hu/YjWEwT3jfVrfVOjNgoHhAgG6Y4ZttG1VavuhDuMVtrFdYGNJhw24urpc2jrHsCUs+yoZ1DtJi7bosqVLbRI+92RLWkZBxU6pvnZ5XGOx2UpUg/kGJ0seubo+DD4u+WkI94sez8b8OE79K1AncgJEbNmBw30odTWL1p1VsDZBSA== X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB245; 31:/lO7RQH6AQHmHiJJtTynkdw59dSAkhpL2EA6zAVOOMOohcQWEMNjx4wxWLvTrXSPwmOwbRPw4zDSozdUaThnXKoSftjbbsq/qtYyBHYLv0KfXfmHAW1LmWot3YvgIIKa1S7rOPNxh6spvdgd9GsRVe2x04IG96lzEAAGHIb5UWShki4OAgplJegoXYPPlgqB9lQbAKaa0wFzHrti1PgYIMhmTA7o3dk2WzCTm7QKm7U2O1bbniMCI2tAQvX5Y0fpgtZbJZDXa4YalMm3ZIEOaQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(8121501046)(5005006)(13015025)(13024025)(13017025)(13023025)(13018025)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259075)(20161123556025)(20161123565025); SRVR:BLUPR03MB245; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB245; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB245; 4:/8uRnlLvn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VOigzh5FHShposyOgygb; 24:wzTJqld+Gb7TWlDGQ/rBVM1ac5Y/Zd4jiFzp4658kh1QAj/7AeOVHhqsELyLQ44Vx+VAYUYy5h5D6HHVPFE2ySW+/DdjE19eZ4JwO1IntmE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB245; 7:sK3WrpGh2pDFVJB9FAAnXWRpxNNrlwNVgbazofQq1HtQoqLegqbGSNXoM1wvAuFpK512ZK1zsSmcj8qEqy7oRawgTcgmx17ramDH3Locmi4xWRICGl+RYIihOf71F5qzdfoMUOlg0ULZdJtHT8eRQZz7/5ZLNFhKYnawTFNBOMCkfKp2e8sOzIlKPfWmMTkYvZeLSe5vIITom5FKKEA4tujihHEJG3mu3RhPp3o5YrxLLgdlQL+5izKSKLaG5fodrHygIJ8mj3DQ0ebb3suprBgb5i1BnqrwwyHK26NlGmuEXjQRAJc9xPFJX6ZWFuLKXp4ybsjg8O+XiPoYkkHsAw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 13:50:12.7092 (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: BLUPR03MB245 Subject: [dpdk-dev] [PATCH v12 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: Tue, 11 Apr 2017 13:50:15 -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 4350f45..7f88e9b 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -58,6 +58,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 5618feb..61ce062 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