From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0058.outbound.protection.outlook.com [104.47.36.58]) by dpdk.org (Postfix) with ESMTP id ECA0EF983 for ; Thu, 19 Jan 2017 14:25:22 +0100 (CET) Received: from BN3PR0301CA0009.namprd03.prod.outlook.com (10.160.180.147) by BN1PR0301MB0738.namprd03.prod.outlook.com (10.160.78.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Thu, 19 Jan 2017 13:25:18 +0000 Received: from BN1AFFO11FD009.protection.gbl (2a01:111:f400:7c10::115) by BN3PR0301CA0009.outlook.office365.com (2a01:111:e400:4000::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13 via Frontend Transport; Thu, 19 Jan 2017 13:25:18 +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 BN1AFFO11FD009.mail.protection.outlook.com (10.58.52.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Thu, 19 Jan 2017 13:25:17 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0JDO4ev015351; Thu, 19 Jan 2017 06:25:14 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Thu, 19 Jan 2017 18:53:46 +0530 Message-ID: <1484832240-2048-22-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> References: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131293059181613365; (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)(7916002)(39400400002)(39410400002)(39860400002)(39380400002)(39450400003)(39840400002)(39850400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(104016004)(53936002)(97736004)(4326007)(8676002)(105606002)(85426001)(86362001)(81156014)(8656002)(5003940100001)(47776003)(50466002)(81166006)(77096006)(106466001)(33646002)(68736007)(2351001)(305945005)(54906002)(38730400001)(48376002)(92566002)(6916009)(189998001)(6666003)(36756003)(2950100002)(356003)(626004)(8936002)(50986999)(110136003)(5660300001)(50226002)(2906002)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0738; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD009; 1:pw8XlLwHhErCjCQXAbqFYzvChl6mgeEUPGp0Cq9NsuJ/R+3xWQvfe3vH/wX8uVbvF7VMokoUT9hizULAh9KLRPL7d/9eLrKn8osiiJXjy1cuLmYPg78MG0ZDo8kXf98ZM40cnkCU7Ocpxk/CxShInwI4gWvtY2fWNyKqdi4Q4krX1eXmrG+NySArSfYkOmQgtSlpgoVJ/oOoG5zIAY/CzmZNzur9ClIZkkdvdJMn7Yqf7cCGe+OUzqKxVScKRctqg3Mh+EfBjLT0mROs3zmwlGpSpzD6Kh4sSARf94BdUdUMzm02NAbm+GJ5UV4fc5tvA3D5TZUTLtkqgSFRw5Wcx9OEQQMvco/pmMMY+61PNZT34mK8UcfU19qmat5cMCtF7mHZBLt9SB5HSkSVBx9FsJ2yj7boFg1ZwDe/k3pqLlxAGM92SUMjSYvks5uAAd4vVbsM0xMcMZCQNvf43HzK4Od2RVgeKW9rNZWtz9hL1tWBksImDyRsFAqG03sPuAkzmuq8eyme2yr7ECpq+8udwF95fBKhKe7r3x5a3W1wl4Yfjq7tIXL+Ud7Rh0i6BJWgE3hRCNqnOd2eafbI20mwb4KiBOh2IsqvAgKsjebE5azz+ul9ZiWbVjsU27sevMbufEmc3EMIM4kAXTML/g1B288A7O3WlRWlB8//4urWQaVMpscSXH7B4+M8nK8f0RGqfDHVwQ1Ew6SIhLW7hTk0Y+V5Xfjw0oAB4UJ/TK5BsTj0f9IOsri66gf9I+/ivZJ8 MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: fececca0-d9e7-4939-2fd5-08d4406e9c73 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0738; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 3:yi1MIYAbrzRzVCIdgL7LJdtaMzuwrWTZ2zoZdh2TsBlygFVcoBQNVdHeAtVP2TzQySnDa1vP5TS4yV2pDZJItcm915p+ldca9xvSrF9XWy6g2vrGhNW5CHhFf1AqWiDTvQPIpBgBUZmX6toGgB+riBrr0azJHy6QQmMUQuz963aLjA33Ep/tJDNjg+l7peerdGOIn+hnBe9oaBFdn5XbPmk2CkaFGdmf1y/MdvFUwU2zBb4EKujNvI/aJYB7SImEpzIOuDdFoWd/kMT50F/V+6hcAiG6jUAjPmqE67faF6I/hasAp07TGOb6nI7yjoddYYWpYGSezN7P/Ybb+y18bj6+vF+yZOGkGoLfVJe7c3hCVW98dBHPjOqf2V/ghwub X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 25:JrBlQkT9khShVMfjPLnBQAADuOweEO4CCKCNwvMjFWp96qskoZs2IgY+sggLqjIG/rrjRBiwq+wRIiitXLAtS5KDrAhw4E9MTL1X9+prc/dSj40nBD52VpZwbRR6XPbGlOSQSeUzxLP1EfMzu7nLFrXx7yyhgPUcQOG7rjgWAW+PnhifMBYkob+y5gipxFWWRE/iXnTPxyv8tSw22lR1QB2JfoxBBLoIQauNVnh+v6YHqjEbplJZCOmH70aTQfdaB1wWKSd0cq+sulmpHY3hsj0MMllzTPiTXKs2YuSXGWzvL+gLEaNBdbeA3WpTq3c+qitBSgF9oCfzay6LuUBUf2NbRJIvjHIusBO2pmt9gmlmEtgk/CyXj2fmCQWzja41gw5+WrYtAxbU6u+TX6YTLeXkACtdhkisBZf2FPLTnxBwsrzdD8n3Sxa3o5P3L0mT9rYlZzYFA9HCWetVB4gL+SIj05QvP1L9G1OsJA9usDr1d1gNYfLJe1cZ9Ef+VOmQd9d0vUROlNKq9rUWm+9idH+5e2gjSN7Xdqn5J/sl8GRpS6GOFX3xkgx9gc5fuACjueHtXXWqH/RGIa1zT3HcW923qahsCkKkrRDSWQibmDyDtwxwqCGBNve+ddvlHo2YQwIlCGPRVa5Na1g1dOSJmavIBbsR1ebAR/qhtyVVEK/jimaL63aORVqCQieC7WgM6TrRtQZHYRvBRAypM0xepErDuRMExPQeV1eRIdzQ8Qr97C1FQl0/sbf0fGk3A2w7OQV7bAD7JuKAol0oR0TsjRtHfISvn7NfCqsggRAnQ1g= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 31:5oPEEdluvKF63ZW9s+/hkvSDgTwXw2XXUnBh4GwpaHgFGTDlbVg7hpj2AxNAcQOSZdVWsyrAwRDPNwFY4nXDVRQxIbnWqRY+fWolo5AnR++OOvrCTq89r1mzKk0szkejAVogz6zxLGltf2gwl9Zz29t7vTJ7GeO8KpDh2HO5OnZu/mYtIw1YUUWOngmlZfdgG6nzBj/sdxxyaierLepAicQhIxFuutKthVDvlSHRMofrT878kczlTZ2jYuizZuMp6yJ2iIV4eFkmDzcKDH4L/w== 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)(5005006)(8121501046)(13015025)(13017025)(13024025)(13023025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123559025)(20161123561025)(20161123556025)(20161123563025)(20161123565025); SRVR:BN1PR0301MB0738; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0738; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 4:lML0EFC2zFSibY8Jqv9t/PJP8FeDnawKx/ndFch+DEXUYjQqalfmWVRjZkHPia0A5ydYfl+Jn7Xmrw+SSJY3pqULCa+BiqSRtZb81HLK86/KsDgN9jBysmAeTFaXnxbKufTH4/fGRNzSq9MvOeHfXjQA6GMN2ryE/id2vg9rsOSDzt1pr4dEUVkV1QU0/I5Y1Lcv93Nxodc1blYu1hpr4HMx8Px+yeZTgQyIHiuk9KUCYOuqSOP11Ho5oVbtivm/vo6bi49kaj7UhosoKCL/SDjtfT3v0gS2y8fdPQBfAZ6KAmUwK16XScpVuIFwJOTBr1kaMFtkTFwr8EeOISMfzWD1yGAfvwn/0+9UtHz0AmXwncWGDUjWhE9mjt9D0Pvrv06n8lX7SKIGydC+h/T9APNULXJ+DmW2YQIxVFPMFecQ9R74xuPW51gYxM1WaXpynyW+Yvk7zOrM1Wm1/3joR7JmuJrz45Zoc0R7YQA61RrvETn1BSYvT1CzbQ0FiwXw1YYp7gwaeR7BQXMq+ACzOWQWDY2c+NAsWNQbz6fLHK3PbtCC0697fA+NsBO56kC32zzYA+MrcvrLw/+dsAFHUQUY7Kp9dYi5zSdqTrTbl01U7jgIXmBPNvmO5tLTAZFQhagDFA80jl6owspe061+1jyeUogim2WVlIWqPnvWOc35SaCLz+tCBMyQnvRbDyVUojk7IJXNW1NLYxLFXLG+IgQe40GKFJ3MH83v/frFIbcgCm/bXlGA8uLwWHvT0SFN X-Forefront-PRVS: 0192E812EC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0738; 23:3Ujuzzqi5yEkb9LqzVzhFXHyupzS/5bNH8NVRsa?= =?us-ascii?Q?k4QIrW3pk1n/S0H5OS4ar7IU6fmtTRNXfnDiB/jEU0YLszh1XbFuHq8q9Ziz?= =?us-ascii?Q?U8GmhbeX6jvSwd7nd4RlINdVf8EMvhLTUGPlZNA7NckK0IP5j6OS8cj6VHyV?= =?us-ascii?Q?cqK8Ra+H5q71LkTG81XKR2nVR4QhMjseopsaXdifJJgeQAOk/02nmi/AxG0I?= =?us-ascii?Q?PbKOs/4qZ5Wg+ytaFAlUXc6YwRbnzT4FZYAVn9utL9NF33ilk/i6B464CIgb?= =?us-ascii?Q?NyXxFlicp5rMC21lN7dJV+1HKNdH9698LEwOutkTsLOHMfzlMePohtz/k8G1?= =?us-ascii?Q?jPlF8ZSu6HW1ETrI6BUju0XaIyzJ9ivlq21ms8Bql2les+OXfAecE2KBiBeC?= =?us-ascii?Q?h8KiHP/ndsgn4mbOLDNdc9HrenRBZ+jHa0LjiF6qi9o5A7WfeY04cc912VKQ?= =?us-ascii?Q?VxxJiU1NyRZDSLGNHQKt2HrNMUWlt6FUmJxy+Ts4OGikvANlFdrOsaYvLSxn?= =?us-ascii?Q?Wfe4nrdJhtOge8BcMAN41vZsVfdl+l1jX6YWgS2vIoy5ynarT30smfYZtjjp?= =?us-ascii?Q?gCPljAWqr9toLM1zUPMs2oOojDghXJJ8WZtTIi/n/VgcJbN8OVPiZuKfaMZY?= =?us-ascii?Q?BWYXTGYP18oyVCfbD8st0Zgsn552CRkyCRH1Oanj99lw4c/SVdcRbinlsZsJ?= =?us-ascii?Q?0ix9miICXVGyC9NzgTt8eqaZzo9uEqfz4AN3pxxJOdb3phfSLoiozeLMdcud?= =?us-ascii?Q?yE6IAVL7gSjoNitlEidWIWdkcyFyrYQKCeOBxJBGdc5FNRhb/YWyIH2vMwSx?= =?us-ascii?Q?8BrKALrAR9TcKmxtaQUK/lV3REF2m9QHWvA7x1M/YOWjBsH+lF5yI7f21Uos?= =?us-ascii?Q?BB1KAmCVANg2D7rYFmn8aixh4NO4d6qJ9ISPvFw91FgUM0bM1thTQUynh6m4?= =?us-ascii?Q?nsyTCYNHe7oEXfa/rBicfjakkKRnsmR2MFGw3a4cYLPl0Ye6MTCOslWgdOxo?= =?us-ascii?Q?oVLQfwpbbaZzZNPRCNs2sep/4eX/R5ZqDpdpHdYua0z5csGHXY18SCWda9VL?= =?us-ascii?Q?zNggozlWhhvSJzag6d60660tWypSgfZYDk7Tkq75odBtQocsSji4yCNkHhwO?= =?us-ascii?Q?Alsscmqe0hRfm5rNCbAn1YfUYontF0B7qWv0Aojgj5wUPOvah4YPciUBIJYN?= =?us-ascii?Q?E3zDUGHuUiFfPnaYlvH2IwO3fL0k48AUhu51EwvgFKyAFmo5EriaHpIJ3JIb?= =?us-ascii?Q?AUE8JwCHCgsUX6Xu7gtj5GKnyxh7eVCaipVNkrV/8OhfG76vz7mhxQULffZg?= =?us-ascii?Q?PqyZ872cruJmqNCQj36/hrXc=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 6:B5dk7j5XNCXn94EXlvcZuXY+BcZ90MOcEeeoGtyx8tHIzvQbk3nv9Vv2iY3JJ4i793Y698tUPMicQTF5eKC5jYsWI/Ptc1btFi7Yp8DP5UfOvm12RLyThngDRJCU7UbZruD7N6kcG8pJ4kMXLLShJ2r3pkpCpwQdULC+cLEmZCDOcF2xOk7MKYRCnMKghDI2FGEss3GDM2wMWdiftiQKE/sT5TsRa9dJrUjqtEtj+3oJP/ZA2966jctneyKxYJaX+kR5IMdvOq9jOB685CDPyKO37euw5D+v6cRk+6lV8bDa4p/cTaOr4BwZhA1f53PgP/iL+F37u3GiNJo19f0fq54wWALxdb/3G7e8zRivqHrgo1aopRvMvhIURZrmOaX8ZAolkjsEj73XRoTa1T/uPps8n1OeQCUKfr83Fw3RkIQAIl6Fp2qmqWH2sniSf+0M; 5:72jqymwIi95yEayk5Lr727KTwFWoBVIae6tYwy+Pj66w8hjlTORSimPgbTEQgWJd8kSd21N2GdZQH7VSo6pX5QEbBzZz+SBBm39ENCKRufTyYspAeTBtSteGiHE6W/RtFuTkQVh+KI2Jbvbk661W2lvtH4SAGgYHQE7WPyP25psKHncqSxKjWuqJi8Qn3WMo; 24:sp+CYRQnKguDwYrW+Mn9Ow90hslhYhiy3tNmsBf8ZgamOVhIdEwM8uNcY8airgdA3tbt34LinB9vi67K5b2SNrJ54KBk3UPydGadOS5CG6k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 7:rSzIgKZbUEkqCcFOMvNUNfTuelOe5g5ouj3sNnXzEtdGz/9ge92AMhSjgCaveoTiR6Mga0GzpuitXGvpn6mUk/edGHwn//2xXusMlIF4Uug6yHlu5IxrCjiddR2U4WIASKJOpFX7LBg3vTJS8VBWquTkeKJdl9gxbr2+S+5Rr4WdJhP/zd4Ycin4fxDP9DIjDownJ52BJZ6twbGrv9fMCCJoi8gyUA9M5LMupBPAlfWhCMGDZlhJ1w5w2cfHGIGNqs+zho/ZW6MiBXCF4xZeDy6ZQAGXr+4JU6gJKZcuHaqVcL3okqII1xoYGHXg7KGRMoIopibFZD+GB3Rop6DP5I9bppKrkV7BzP10Gt1aTIIuJIKXvKqSxyrkL9HkHu7A274EiSPGtfT7k9sKUkIg1IJLFTqwkJZrI8MyVzXMHwvIOYLYKElWTbzlOwnssZ8uvtHIyl7MJgkacA3uDi8SZA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2017 13:25:17.9741 (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: BN1PR0301MB0738 Subject: [dpdk-dev] [PATCHv5 19/33] 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: Thu, 19 Jan 2017 13:25:24 -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 61831cc..657ee2a 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 484add4..1d7ca66 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