From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0078.outbound.protection.outlook.com [104.47.34.78]) by dpdk.org (Postfix) with ESMTP id 7A8F5FA84 for ; Tue, 17 Jan 2017 14:20:57 +0100 (CET) Received: from DM2PR03CA0053.namprd03.prod.outlook.com (10.141.96.52) by BY2PR0301MB0743.namprd03.prod.outlook.com (10.160.63.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Tue, 17 Jan 2017 13:20:56 +0000 Received: from BL2FFO11FD051.protection.gbl (2a01:111:f400:7c09::105) by DM2PR03CA0053.outlook.office365.com (2a01:111:e400:2428::52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12 via Frontend Transport; Tue, 17 Jan 2017 13:20:55 +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 BL2FFO11FD051.mail.protection.outlook.com (10.173.161.213) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Tue, 17 Jan 2017 13:20:54 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0HDJ8mc021741; Tue, 17 Jan 2017 06:20:51 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Wed, 18 Jan 2017 00:22:52 +0530 Message-ID: <1484679174-4174-32-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> References: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131291328548331101; (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)(39850400002)(39840400002)(39380400002)(39410400002)(39400400002)(39860400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(2351001)(86362001)(626004)(33646002)(106466001)(356003)(97736004)(47776003)(575784001)(5003940100001)(305945005)(105606002)(92566002)(38730400001)(85426001)(54906002)(104016004)(50226002)(189998001)(77096006)(2906002)(68736007)(8656002)(4326007)(8936002)(81156014)(2950100002)(48376002)(50466002)(8676002)(81166006)(76176999)(36756003)(5660300001)(6916009)(50986999)(30001)(110136003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0743; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD051; 1:Z7Rn42jJp5uX9MvwqTWToQTQS/fvecHkWB5AwkzpIqKtCqJX1V2dD4Y3U0D4saDn5Jb5tUS6xBsEWPjmW7a0L+w6BdEIiFDbkh8Drdl7+qnkiP1ox3B3NtZBhotYz/4s7LHS74C8EGk0LFqOi8IBzIzB8gZfbsuaGUUeHd3MFUrG1nKamgBe/GOeouj2EEeS43fAmK8NYTyGQGeUlq3+31Q+CW6WsT1Or/3uFLPBC8OhYZeEd91XiWDnXayTJbNYt8+O13JAtKsVuRgYla7DfpPpYK3r18CXNqLdV+RdRV/KlINXBcfuk6J27rknAQTV5TpcMkQuWXOCSpLhOk76/6LxafUtwY7PaLbrFpgtwBcoAH1uFJ1PZzVBjQdR1KgyKt2U+Ox25GdzIqYzZPnuqGH+oWeFHtzM0h358wrTU1KpyijDIGqX1gr1MhsuwzVeCGeWVV2XkJMykabbg25XOykDWS6NpVVVYrIFntysqqlCdqBFy4vZdCaXziXzNGUK3R+mRqnPaBSsyW/EHvyfgZW8CNQBZeCVEPEWWbJm6wQ+4BEgLyv7oKjfbUnoUiCOCNKQ8S2J1AHAem0ontDQcYQB7iCfafwVcMNUaOLV6TO6+tzGqaeJSpx5bjIL5Jsz94JOPEjMzItuEPsAGXfN9zFs73io/+8Rhu37EqKzxmILpqXxXC8wLdBGTAFwkLPu1e28BZ6J+THCSm/0hHYfQHdhJY6wmeX7msYAy7qUZS0vPyGpNtKZeRQoB+G6G69m MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: df09942f-f61b-4706-fd27-08d43edbaaaa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0743; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 3:TNWZn1cmWxhv7CrB5aSmqBYkyg9x3pl1jcHH7LDiJwMQEQUgmhWFI7R2+7zWjHwhji04Zur3Bq0xwOM0SjhACfhDfNsEvZq6F+N++kzy/h+ukvTYoUoZgFbVjalA94eUQDMbrGIeV/dZe0adn9+V5OfGKHCc5wduuMTI+1JVCscv8/fch3apvG1IFuSENAqhJWIfgSl4BlnEBx56F2Kz0jqPO+SDi1tqhRmhUhmHrh9A991fekAdnkRcGaXIGX5ynITUdswrFEggOBp8k72j7D6UTWm1qYieuh/wYBmCy3ftOt77t4FrVn/JFeopONuQJCA4LKsWzcJegS+6zes+beKmMnMefCnRRd95yU+hbZ4T2S+p2jnh0J/hH0Aq0KeL; 25:AqoAmCcHgNh44svdUMfEUVRd4+QR1iteMObrEMV4rcRy7U9/nDxjRSjmDTzXjv4N7HwLxDTtGTqywtYdPUu3/WXw6TK+Tehcs6NGdOa9N58K7LRGaCjgSKP0qvSMovyk/i20vD7cr5fNr+QAD+gvPQZ2e6bv8+X8l/1LQs8U//D2SJHuuyqD7UPkyd7WKvFkbrLbU/8tw9m0L/Ifj9o1JY13m0lscS++kaX9avIs5Ot+eQ/YDFZ6x/nZJYT+MlZBPZvyuGGZzpjHvW8flbtU5CRkrHz7Qli0HTmPTTng/rvaxgi4O91fWEAq/Jq2SiXF5Az3sJpYazO+FX/dTHOt/l56+Lsy3e3xkXDfmyR8jRZUREheqPi7/q2omuCkDws1jqGzAAIzkJ0HcBdtOux+eFkWfQoAZuCLwNvgILlB9W2LeG8MQgk+uXsBcI1Deo22m08uACztEGI01tR5A/2W9Q== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 31:zUTKAL6xVcCjEU2XHyCKC0XthvoqoNyBR+f/aXt1sEiktL8TChwKjy6LA081RrKxXLG5u8KhUhJzS2y+eMuUBFqmOliSkcQ2VCPpSRBKaB84zxpmwEqpDC5Ho6LICm1xsxY+9laMbAl8ZwSo6zkglC19O9Oa5QEzEUqqYdzdL12cHKKO+jw+LeTeIoCOMNMu9OLAC24uS9AogRfC6D2Tv8S7aDFDWMKXrP39KV1Kr/v8Q9rNn7y4BF8vwBkwxs866PBW/RcDBqAiq9af7Mp8yA== 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:BY2PR0301MB0743; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0743; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 4:EVJ/Ge2PBN4B7wa007dXNyimIKlO6Z+g/D1gE4V8jMqNaHCIqe0KkKg3uk7C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/0JplrInI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 7:Cr3Imx63uFSvIFnA2pwcQw8crGRxAPg6DNhkcr/A4TRN52sAdANuQ98x/rIaa0h9bszdqnofTX68U5i81a1O1UFYVxISlI83QvisIHMhtMFdyDFFdh4kiCfQFEKNpLMj7uN+1aMZ1lXptv6pWn7AWgNYp9uXBWDjZgjWUqxDgIzyvy6o5vNCVRaIfuTEr0pVd/fd2656g2sKsroYoYm2u+4KMJvlT7LzmlJnne87WIqM6x76CrlwFqjR/MsMOWgXzqF6NaHglIXnJg7vA8AmcCNPe+qBP0ZT01Ih+NzwVP2Vi+DamVh5uY38gzbn6hk3gUq4Q7oTPDE+83mO/3ODNTB04eixMcGynaKKoTd1ENCLk5tRhUun0jdY/Dx0ZJzGytE/6FrM9cXd9dWf9ewK5yniay6em7Ih3epLIqNyfjn/e/2hscLZH0hAr02wj2h1qDD6S1rZjJfYVEAkailIfw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 13:20:54.1624 (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: BY2PR0301MB0743 Subject: [dpdk-dev] [PATCHv4 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: Tue, 17 Jan 2017 13:20:58 -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 cc0d4ac..e6ced14 100644 --- a/config/common_base +++ b/config/common_base @@ -285,6 +285,7 @@ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n # CONFIG_RTE_LIBRTE_DPAA2_COMMON=n 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 7665912..18c9589 100644 --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc @@ -50,6 +50,7 @@ CONFIG_RTE_PKTMBUF_HEADROOM=256 CONFIG_RTE_LIBRTE_DPAA2_COMMON=y 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 158dfef..052a171 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 55068e5..4596337 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)), 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); @@ -218,7 +219,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); @@ -270,7 +271,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) { @@ -311,7 +312,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) - 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 f36e909..3875d7c 100644 --- a/drivers/pool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.c @@ -203,9 +203,14 @@ void 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 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 hw_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