From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0076.outbound.protection.outlook.com [104.47.37.76]) by dpdk.org (Postfix) with ESMTP id 4C1E1FA5C for ; Mon, 23 Jan 2017 13:01:55 +0100 (CET) Received: from BN6PR03CA0064.namprd03.prod.outlook.com (10.173.137.26) by BY2PR0301MB1573.namprd03.prod.outlook.com (10.163.28.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Mon, 23 Jan 2017 12:01:53 +0000 Received: from BL2FFO11OLC002.protection.gbl (2a01:111:f400:7c09::141) by BN6PR03CA0064.outlook.office365.com (2603:10b6:404:4c::26) 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; Mon, 23 Jan 2017 12:01:53 +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 BL2FFO11OLC002.mail.protection.outlook.com (10.173.161.186) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Mon, 23 Jan 2017 12:01:52 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0NC07et019311; Mon, 23 Jan 2017 05:01:49 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Mon, 23 Jan 2017 17:30:01 +0530 Message-ID: <1485172803-17288-32-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> References: <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131296465125264224; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(336005)(39840400002)(39380400002)(39850400002)(39410400002)(39450400003)(39400400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(305945005)(356003)(626004)(8656002)(8676002)(8936002)(189998001)(97736004)(6916009)(33646002)(2950100002)(5003940100001)(110136003)(47776003)(85426001)(76176999)(50986999)(6666003)(5660300001)(68736007)(105606002)(92566002)(4326007)(53936002)(2351001)(36756003)(106466001)(86362001)(2906002)(50466002)(81166006)(38730400001)(54906002)(77096006)(81156014)(50226002)(104016004)(48376002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1573; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC002; 1:g0CJI7pt6IvGNzs0EkdgKEUW5WbThoeH9tms/siEQvc0Elyrj76zqQ4unUicL4uQOF9AgrfZgIsZ3N+AIyxyU0BmFHOPrkcPovQ9X0eBXq8V7NFMEyrh1W0uBnCXJvp6+fxr+e9ejsYkxAVfPBBrsd1VOs0ivmnCPWPhZIljxEpGwfQ1IY0VcdOx6WKVcAfzCc1NQsXeDqLzJWeyJuqMoFeRE3Ktf3nU1lpoY9aY/uy6EfPgJrxbYus51/dVHx03N39UQLvwddwzlLzMTsVomCZJqG0IRTF7Pj36yqx0XBR1wEo2MV26V8Y95rEe2FnsXUuzlYkYyq9m/deHg8z0wvGxD+zmnzh1ScHlJ4++xYabvs2Ws+NslyKgt2wR6P75A7sjWfptA8vS4vCz1Clf4lX7No39mKuv4TIOFQZnhLy5zpGPQwp/3k1nHBU0ceETVvuxdS2+IeC2zgRCQk0Ao0vAehI7O8k2rLA9b8EF4jANs19KnC/OU27HtEknHO5WkMXFt7DH55fZMzB4pJV2mh5iSSbA67dE0lzeKByY2MoZHjusRwXVcsVuCoaVNRXHvtShuIaS5mNZFfn8l6Es8P8MBPd85i/BkPOL+pN87Tf4UInS/hFwOeWSncVR/+bTXMtZG8YNEyzCD+JmMQkzO+2ZqPjAWgBwV29EQUqfnqaCxziRHu3q1at0KmmHsNi5XDL00dChvpNjD9v1AhHnbzshaG1e8pkTrgEpxQ9dRHtmhwH1KVFq4BxVnyqqdxrC MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 134319d1-7c7d-4fed-ea06-08d443879e82 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB1573; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1573; 3:e8/uTHb2cdN/5rX0JW/6DsIwhKNu4R3sPN/6J+F6QdWLK7Bs8qblXKs0t2Vra8alWNgITPmztvfvC0XqEOd6W717IBsz4/C2KFqLWnHOj/yiCpndaPhkRfU0cJ3eqGc66BekmKsLK9xttxkCI4HroePkAORHDRNBkqeG5xdSBdk7g7f5CB/d4dpBo/zx3p/MGvX4xXsWmy30zB9ixG1JRFyC0SnM3RbM5CHQ/+vYDx2MDqIWlSiQWvMKfBVnNfRhynW8OAbNWF6BMzINuBlqdO2B0zdoOaYsBz+xaDG7EkLF/rcbdSTfEphCPhg+j18mTAIbOgVPVJqRFiGzpXaPHB3ZtAWJmSJvcGCQsAeaPCcDcW3VK+245DhscEKNndr/; 25:oCUy2uff5WhjvAu8hFH/xCwfNNJcqp9JnavIK/2MWQZuY1RIdRKh+SfQ/PweCqdvV8C9iGvzxOqOLyLzgmzVnRCdTDT+eNWHcuk7AP/2QATyhxVri1Px4NtNMHuYkkWfiKeVDMX7kyjCBwt4kD1cTC7rChGos8oFRe2p3YN6vIjRPZ81YuItao462d5YWBwCFdEgUBZ1lsRR78iIAMFAkwoGQdvI+bN74WmGdwaoIMO19rpNmBxo2YN6TAGd18xRFtnf2pGWaqkpxAv9aiLQS71xfl4RH+Po2oWclQdWOoYMybI+cOGoYa1cvHSdAbhxcU8DVCtUW8+Ualj2GgsQlfX36MPGhVql2MKfqbYqW1qjQKNaKqohCAql2UvkSB00TOYXBw5J3lJ95AH/8rP8OAGozk5bHSMOIPd2jfcqE7uwbAlxwn5z4yYsYeghLuNCMTl4E4IuawHS/TquICDURw== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1573; 31:bNtqIY20f0Ql0lGb7/rPPltd9CWf+kmq257klLB+tWbWdXlJhk3fIhm/kIKvjHBrOnrmc5t3PIZt8N4yXlOCbQ5GzDlSNHKlASsa4HvJqmdFwTiSUZNm7y5O7cvAOWo3kiIIbUnrFOs4yiGdQvOtACrM1r52OZzfWxTFWUDFUfdtebWNImJ994/WcoP/FFVC9ytYsGzztSh+krAMLuELqOl9MMvI9JAJKDeJUoqWnK+TH6j4jLu+AJbAQlYPJqzpb3RuK75P+5OCENdaxfEP9Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13017025)(13015025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(20161123565025); SRVR:BY2PR0301MB1573; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB1573; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1573; 4:0UMHi0oj0HhcPsxplQIzpXHmpfCWt5J0M7E62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dcE; 24:p3bLb2kYAytpw0/hcNkzNdOAN4omklaKhjyvjr4i3xMOV+5iy3Ho6zC3v5sY/CrPFsUOJMNxr0HjV1T40aTfLXvCoWkHmF+DVe0I4/9/vOk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1573; 7:U06QspdtUVy/uCcTZThApuvSnsIUiL/PowB0telbQRT/ujaMpmNqejW0A0KV0FW+Btk2BEbcjxrxW9s7YXZbQBZxwBXWM1Tp71b/6nYI1rDEp0sRfxGp877ttmTF2Vzi7Sw87z9WNWZ8AnhsZ11z2NRXct4tM2wwm0UYZun4EVBSjQxjuHQ8qKcb7dEIrTMvJXiDAgR+swWJ42uwTSXQlDXKjw+tDA6RQSYVueccOOoXgplZTpFu2wWniBG9YUk83YRP+X7QTo4zvigdewLFFWopnmQ+Ff4gl/70bwezPZMzSNyluf1HnjNFtLkWv+RCPX9EaO+yJ04JzRP8sIY2/aSkCl1uqgn2kDE17CZT3Lvrr6apGVDugeyTyCbLh+BEibfbWoFxSj8Aoax7ANDx+H0UYUjA3/yNDXXeeKkl4TUoqRALDAzst8vsUIZLg7oKF7qaimBo5RmftFqi83vhZA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2017 12:01:52.3392 (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: BY2PR0301MB1573 Subject: [dpdk-dev] [PATCHv6 31/33] net/dpaa2: enabling the use of physical addresses 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, 23 Jan 2017 12:01:56 -0000 DPAA2 - ARM support both physical and virtual addressing. This patch enables the compile time usages of physical address instead of virtual address. The current usages are also set to default as Physical Address. Signed-off-by: Hemant Agrawal --- config/common_base | 1 + config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 + drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 66 +++++++++++++++++++++++++++++++ drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 4 +- drivers/net/dpaa2/dpaa2_rxtx.c | 16 ++++---- drivers/pool/dpaa2/dpaa2_hw_mempool.c | 19 +++++++-- 6 files changed, 95 insertions(+), 12 deletions(-) diff --git a/config/common_base b/config/common_base index dd3de11..6f1787a 100644 --- a/config/common_base +++ b/config/common_base @@ -291,6 +291,7 @@ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n # Compile Support Libraries for NXP DPAA2 # CONFIG_RTE_LIBRTE_DPAA2_POOL=n +CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=y # # Compile NXP DPAA2 FSL-MC Bus diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc index 3cdb31b..29a56c7 100644 --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc @@ -49,6 +49,7 @@ CONFIG_RTE_PKTMBUF_HEADROOM=256 # CONFIG_RTE_LIBRTE_DPAA2_POOL=n CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2" +CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=y # # Compile NXP DPAA2 FSL-MC Bus diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index c26360d3..ad8a22f 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -175,6 +175,72 @@ struct qbman_fle { */ #define DPAA2_EQ_RESP_ALWAYS 1 +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA +static void *dpaa2_mem_ptov(phys_addr_t paddr) __attribute__((unused)); +/* todo - this is costly, need to write a fast coversion routine */ +static void *dpaa2_mem_ptov(phys_addr_t paddr) +{ + const struct rte_memseg *memseg = rte_eal_get_physmem_layout(); + int i; + + for (i = 0; i < RTE_MAX_MEMSEG && memseg[i].addr_64 != 0; i++) { + if (paddr >= memseg[i].phys_addr && + (char *)paddr < (char *)memseg[i].phys_addr + memseg[i].len) + return (void *)(memseg[i].addr_64 + + (paddr - memseg[i].phys_addr)); + } + return NULL; +} + +static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr) __attribute__((unused)); +static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr) +{ + const struct rte_memseg *memseg = rte_eal_get_physmem_layout(); + int i; + + for (i = 0; i < RTE_MAX_MEMSEG && memseg[i].addr_64 != 0; i++) { + if (vaddr >= memseg[i].addr_64 && + vaddr < memseg[i].addr_64 + memseg[i].len) + return memseg[i].phys_addr + + (vaddr - memseg[i].addr_64); + } + return (phys_addr_t)(NULL); +} + +/** + * When we are using Physical addresses as IO Virtual Addresses, + * Need to call conversion routines dpaa2_mem_vtop & dpaa2_mem_ptov + * whereever required. + * These routines are called with help of below MACRO's + */ + +#define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_physaddr) + +/** + * macro to convert Virtual address to IOVA + */ +#define DPAA2_VADDR_TO_IOVA(_vaddr) dpaa2_mem_vtop((uint64_t)(_vaddr)) + +/** + * macro to convert IOVA to Virtual address + */ +#define DPAA2_IOVA_TO_VADDR(_iova) dpaa2_mem_ptov((phys_addr_t)(_iova)) + +/** + * macro to convert modify the memory containing IOVA to Virtual address + */ +#define DPAA2_MODIFY_IOVA_TO_VADDR(_mem, _type) \ + {_mem = (_type)(dpaa2_mem_ptov((phys_addr_t)(_mem))); } + +#else /* RTE_LIBRTE_DPAA2_USE_PHYS_IOVA */ + +#define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_addr) +#define DPAA2_VADDR_TO_IOVA(_vaddr) (_vaddr) +#define DPAA2_IOVA_TO_VADDR(_iova) (_iova) +#define DPAA2_MODIFY_IOVA_TO_VADDR(_mem, _type) + +#endif /* RTE_LIBRTE_DPAA2_USE_PHYS_IOVA */ + struct dpaa2_dpbp_dev *dpaa2_alloc_dpbp_dev(void); void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp); diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 08f53b3..3dc60cc 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -76,7 +76,7 @@ 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.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params)); tc_cfg.dist_size = eth_dev->data->nb_rx_queues; tc_cfg.dist_mode = DPNI_DIST_MODE_HASH; @@ -119,7 +119,7 @@ int dpaa2_remove_flow_dist( 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.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params)); tc_cfg.dist_size = 0; tc_cfg.dist_mode = DPNI_DIST_MODE_NONE; diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index a94761c..49b4558 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -136,7 +136,7 @@ static inline struct rte_mbuf *__attribute__((hot)) eth_fd_to_mbuf(const struct qbman_fd *fd) { struct rte_mbuf *mbuf = DPAA2_INLINE_MBUF_FROM_BUF( - DPAA2_GET_FD_ADDR(fd), + DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)), rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size); /* need to repopulated some of the fields, @@ -151,10 +151,11 @@ static inline struct rte_mbuf *__attribute__((hot)) /* Parse the packet */ /* parse results are after the private - sw annotation area */ mbuf->packet_type = dpaa2_dev_rx_parse( - (uint64_t)(DPAA2_GET_FD_ADDR(fd)) + (uint64_t)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)) + DPAA2_FD_PTA_SIZE); - dpaa2_dev_rx_offload((uint64_t)(DPAA2_GET_FD_ADDR(fd)) + + dpaa2_dev_rx_offload((uint64_t)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd)) + DPAA2_FD_PTA_SIZE, mbuf); mbuf->next = NULL; @@ -177,7 +178,7 @@ static void __attribute__ ((noinline)) __attribute__((hot)) /*Resetting the buffer pool id and offset field*/ fd->simple.bpid_offset = 0; - DPAA2_SET_FD_ADDR(fd, (mbuf->buf_addr)); + DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(mbuf)); DPAA2_SET_FD_LEN(fd, mbuf->data_len); DPAA2_SET_FD_BPID(fd, bpid); DPAA2_SET_FD_OFFSET(fd, mbuf->data_off); @@ -219,7 +220,7 @@ static inline int __attribute__((hot)) /*Resetting the buffer pool id and offset field*/ fd->simple.bpid_offset = 0; - DPAA2_SET_FD_ADDR(fd, (m->buf_addr)); + DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(m)); DPAA2_SET_FD_LEN(fd, mbuf->data_len); DPAA2_SET_FD_BPID(fd, bpid); DPAA2_SET_FD_OFFSET(fd, mbuf->data_off); @@ -271,7 +272,7 @@ static inline int __attribute__((hot)) qbman_pull_desc_set_fq(&pulldesc, fqid); /* todo optimization - we can have dq_storage_phys available*/ qbman_pull_desc_set_storage(&pulldesc, dq_storage, - (dma_addr_t)(dq_storage), 1); + (dma_addr_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); /*Issue a volatile dequeue command. */ while (1) { @@ -312,7 +313,8 @@ static inline int __attribute__((hot)) } fd = qbman_result_DQ_fd(dq_storage); - mbuf = (struct rte_mbuf *)(DPAA2_GET_FD_ADDR(fd) + mbuf = (struct rte_mbuf *)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd) - rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size); /* Prefeth mbuf */ rte_prefetch0(mbuf); diff --git a/drivers/pool/dpaa2/dpaa2_hw_mempool.c b/drivers/pool/dpaa2/dpaa2_hw_mempool.c index 0c8de51..ca42418 100644 --- a/drivers/pool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.c @@ -203,9 +203,14 @@ void rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused, n = count % DPAA2_MBUF_MAX_ACQ_REL; /* convert mbuf to buffers for the remainder*/ - for (i = 0; i < n ; i++) + for (i = 0; i < n ; i++) { +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + bufs[i] = (uint64_t)rte_mempool_virt2phy(pool, obj_table[i]) + + meta_data_size; +#else bufs[i] = (uint64_t)obj_table[i] + meta_data_size; - +#endif + } /* feed them to bman*/ do { ret = qbman_swp_release(swp, &releasedesc, bufs, n); @@ -214,8 +219,15 @@ void rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused, /* if there are more buffers to free */ while (n < count) { /* convert mbuf to buffers */ - for (i = 0; i < DPAA2_MBUF_MAX_ACQ_REL; i++) + for (i = 0; i < DPAA2_MBUF_MAX_ACQ_REL; i++) { +#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA + bufs[i] = (uint64_t) + rte_mempool_virt2phy(pool, obj_table[n + i]) + + meta_data_size; +#else bufs[i] = (uint64_t)obj_table[n + i] + meta_data_size; +#endif + } do { ret = qbman_swp_release(swp, &releasedesc, bufs, @@ -288,6 +300,7 @@ int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, * i.e. first buffer is valid, * remaining 6 buffers may be null */ + DPAA2_MODIFY_IOVA_TO_VADDR(bufs[i], uint64_t); obj_table[n] = (struct rte_mbuf *)(bufs[i] - mbuf_size); rte_mbuf_refcnt_set((struct rte_mbuf *)obj_table[n], 0); PMD_TX_LOG(DEBUG, "Acquired %p address %p from BMAN", -- 1.9.1