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 7A612E5D for ; Wed, 6 Dec 2017 13:32:14 +0100 (CET) Received: from CY4PR03CA0013.namprd03.prod.outlook.com (2603:10b6:903:33::23) by SN2PR03MB2365.namprd03.prod.outlook.com (2603:10b6:804:e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 6 Dec 2017 12:32:13 +0000 Received: from BN1BFFO11FD045.protection.gbl (2a01:111:f400:7c10::1:173) by CY4PR03CA0013.outlook.office365.com (2603:10b6:903:33::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Wed, 6 Dec 2017 12:32:13 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN1BFFO11FD045.mail.protection.outlook.com (10.58.145.0) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.239.4 via Frontend Transport; Wed, 6 Dec 2017 12:32: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 vB6CW66D004419; Wed, 6 Dec 2017 05:32:09 -0700 From: Hemant Agrawal To: CC: Date: Wed, 6 Dec 2017 18:01:13 +0530 Message-ID: <1512563473-19969-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512563473-19969-1-git-send-email-hemant.agrawal@nxp.com> References: <1512563473-19969-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131570371336770757; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(39860400002)(376002)(346002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(8676002)(77096006)(8936002)(50226002)(68736007)(53936002)(47776003)(50466002)(16586007)(4326008)(48376002)(36756003)(5660300001)(498600001)(316002)(2950100002)(2351001)(356003)(6666003)(106466001)(33646002)(6916009)(81166006)(305945005)(105606002)(104016004)(85426001)(86362001)(97736004)(51416003)(76176011)(2906002)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2365; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD045; 1:NoDnmzGX0gaVefed3Q9O3WHQ1aQbRuMHMYvyGbFmVAXZD0SNX26ma/6ILUAuY/j/euEvAz2XR6d7ZsbKvWBX0EngCxapIsG88PB207SyiqN2cFoOu4uCBo60aSM4xzOP MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e8d06aa-29c1-4a24-3366-08d53ca560f3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603286); SRVR:SN2PR03MB2365; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2365; 3:V6Y+ZyfR/z+kqmveh80EUm0Gy+SLfAqG4XpII8vD3ZDimN+gRKS6mTP+BMkIHzMpQgIfCpcc4QcYzmmWRuGv0hcDHkucxpH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aX8n3KcFcs7VXnc3MQSbf0aitArNhac7qDdw7ct0n+DmN++cKbLj68niulGQGeLK/EEagdez2Gnl0TlSdU9vPFq+MLwe1ylxxPckMpXyuNNGj6lrxa1EauST/e6APP+y5sdB2vm4zDnKs26gGtiSm/GteOlPFYTe X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3231022)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123559100)(20161123565025)(20161123556025)(20161123561025)(201708071742011); SRVR:SN2PR03MB2365; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2365; X-Forefront-PRVS: 05134F8B4F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2365; 23:tWV1cKtprbkkNJOo3gZ7Vwk8LOGpsWu/K0iH8sTAQ?= =?us-ascii?Q?5PJmMgCqxBi+MgsCqkwGR29VAsIKuLkdlz0jl0dA37Q7HrBIQaPq1BbVVT4c?= =?us-ascii?Q?+SPqoMcfll5f97nx/5qqDoEFRx+CE+lJpLAC+pXdpVRZE1U2gNl+QIW+Qr5E?= =?us-ascii?Q?qx7X/kaS9crj2T0O1fYETnUeI5WAWew4guW+pApePeK7q3zBJMPnwhzW8e6c?= =?us-ascii?Q?IdPJd84imTyrWgI4NUiDgcFHlxMu54aj/djoz/dkSSVDUo1UQkquGpfjsUHb?= =?us-ascii?Q?R+Uoh3vNbPhpyeMDDB0DvU1mIzbAGl3cT6jcTjgmcHM6QzQtAbMMy5HS6OkF?= =?us-ascii?Q?AukGezg4YNfLxmzmNkkWi1Hv0iYEzf2JRzJtwJgYL0Qt6twMbv08CVzhX9aH?= =?us-ascii?Q?AadHoxu2LJCRfesmOGd0QPTUIfk3zJqUs/ZRNSK6zkjMt96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x4p0jBIoZ0j/owtzwjlhFgUo0DAfm2R1asA+7zb5KPxOfahdvAFZko+Q9MykoAvFOmIIBI7mVYI47KU920lqwxHJ8SyNRNvha79XsI41g=; 5:QC5pdkswlZZd+s2KQe9V3Q1WzsNIjRWu9gRuWGCY3ACeRpDCsHMIXIuVMktaSBsq3wUX6uAxf+ZiciAZctqSaJj1ycLApkRfoYt5AGYHXitZ5v706dAByb/tDVH5nCtjJQ0ktQTpPWPRkoui9Ee/hf0Nd0qoiCt4YbxAT+TTPGs=; 24:6dhL7oKZfarghPPD0tVTAHfeQubLiucb7jFPrXT3VFe3wXgOWlwvhRk+Aj9qyeYu6qoSvThQiKdKtGlAfJWWlPiagXbNx0cfzzB36kC55VA=; 7:L/qSch/QO9/dr2Z+t0c240IqjVfsTYW3tLocoVTLrKPAgvYn3rCJmFoxaGvBhJGzVzqdIdh7ZHvZewbjrRquuAbb9FqI+FXVauTPieGSdoIhgWi0fpDhhsf7qwR6b/j4H8od+4qMxU/76iabqN8BxNtHg6UvZ+cZ5P4r9wY3ist5zeo8EtVxkN17gAKm4AUK1DnK1mmquJESo9hazb8V2VrEvjDMXSIHKG148EP8/NxVWFFzMAERlLrzLs2EEDWD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 12:32:12.7254 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e8d06aa-29c1-4a24-3366-08d53ca560f3 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: SN2PR03MB2365 Subject: [dpdk-dev] [PATCH 2/2] mempool/dpaa: optimize phy to virt conversion 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: Wed, 06 Dec 2017 12:32:15 -0000 If the allocation is from a single memzone, optimize the phy-virt address conversions. Signed-off-by: Hemant Agrawal --- drivers/mempool/dpaa/dpaa_mempool.c | 18 +++++++++++++++--- drivers/mempool/dpaa/dpaa_mempool.h | 9 +++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index f5ee80f..ac3e4ac 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -99,6 +99,7 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp) rte_dpaa_bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf) + rte_pktmbuf_priv_size(mp); rte_dpaa_bpid_info[bpid].dpaa_ops_index = mp->ops_index; + rte_dpaa_bpid_info[bpid].ptov_off = 0; bp_info = rte_malloc(NULL, sizeof(struct dpaa_bp_info), @@ -171,9 +172,20 @@ dpaa_mbuf_free_bulk(struct rte_mempool *pool, } while (i < n) { + uint64_t phy = rte_mempool_virt2iova(obj_table[i]); + + if (unlikely(!bp_info->ptov_off)) { + /* buffers are not from multiple memzones */ + if (!(bp_info->mp->flags & MEMPOOL_F_MULTI_MEMZONE)) { + bp_info->ptov_off + = (uint64_t)obj_table[i] - phy; + rte_dpaa_bpid_info[bp_info->bpid].ptov_off + = bp_info->ptov_off; + } + } + dpaa_buf_free(bp_info, - (uint64_t)rte_mempool_virt2iova(obj_table[i]) + - bp_info->meta_data_size); + (uint64_t)phy + bp_info->meta_data_size); i = i + 1; } @@ -241,7 +253,7 @@ dpaa_mbuf_alloc_bulk(struct rte_mempool *pool, * i.e. first buffer is valid, remaining 6 buffers * may be null. */ - bufaddr = (void *)rte_dpaa_mem_ptov(bufs[i].addr); + bufaddr = DPAA_MEMPOOL_PTOV(bp_info, bufs[i].addr); m[n] = (struct rte_mbuf *)((char *)bufaddr - bp_info->meta_data_size); DPAA_MEMPOOL_DPDEBUG("Paddr (%p), FD (%p) from BMAN", diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h index 6795859..8160af6 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.h +++ b/drivers/mempool/dpaa/dpaa_mempool.h @@ -61,8 +61,17 @@ struct dpaa_bp_info { uint32_t size; uint32_t meta_data_size; int32_t dpaa_ops_index; + int64_t ptov_off; }; +static inline void * +DPAA_MEMPOOL_PTOV(struct dpaa_bp_info *bp_info, uint64_t addr) +{ + if (bp_info->ptov_off) + return ((void *)(addr + bp_info->ptov_off)); + return rte_dpaa_mem_ptov(addr); +} + #define DPAA_MEMPOOL_TO_POOL_INFO(__mp) \ ((struct dpaa_bp_info *)__mp->pool_data) -- 2.7.4