From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0063.outbound.protection.outlook.com [104.47.41.63]) by dpdk.org (Postfix) with ESMTP id B497BFAF8 for ; Mon, 19 Dec 2016 16:22:24 +0100 (CET) Received: from BN3PR03CA0114.namprd03.prod.outlook.com (10.174.66.32) by DM5PR03MB2474.namprd03.prod.outlook.com (10.168.233.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Mon, 19 Dec 2016 15:22:23 +0000 Received: from BN1AFFO11FD012.protection.gbl (2a01:111:f400:7c10::153) by BN3PR03CA0114.outlook.office365.com (2603:10b6:400:4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8 via Frontend Transport; Mon, 19 Dec 2016 15:22:23 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD012.mail.protection.outlook.com (10.58.52.72) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 19 Dec 2016 15:22:23 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBJFKMhv029110; Mon, 19 Dec 2016 08:22:19 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Tue, 20 Dec 2016 02:24:11 +0530 Message-ID: <1482180853-18823-33-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266345435206357; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39850400002)(39400400002)(39410400002)(39380400002)(39860400002)(39840400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(38730400001)(81156014)(50226002)(8936002)(626004)(33646002)(5660300001)(110136003)(6666003)(6916009)(2950100002)(47776003)(85426001)(2906002)(92566002)(69596002)(97736004)(104016004)(5003940100001)(189998001)(86362001)(50986999)(76176999)(81166006)(77096006)(48376002)(36756003)(4326007)(50466002)(68736007)(2351001)(8666005)(305945005)(356003)(106466001)(105606002)(8676002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2474; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD012; 1:+gOr+nsYkS/m5wz0XOAlxE4noOE3dCsvIfBR7JC2p2AjtW4EEH3y1HQx2tqkT6YzPJbhITxn3n8QcdO0DsQK56WWv5A96Hjbgv6IVPnpxQ12cP9x+XdPrPedpEp9cwKS7uhQwyssvQiTRCYYkKXyPAWvDz4O+RyM1Pr9pD88aArpdITCuz9THt5FrWbPKgU46/xL2UOOD+OgOjHoqxvg9Jw2MbZtOhUfBiNDtsDWyjrIM/GyVYucgivyMFM/o8MqfB9HeycrMyuea/Uohsx1ZC+ykBSzQjdGzLPl9u7cMH/pPvv0vuSUx7WtuL+PoiNK3vDz/PrSsyiIz3m7Ydl8HNNC+i22UDTSOw66nPZ1/iluHYwghVecapI+d3oPggR8th8vIE4S3UMvcNbTkpUKHwhQBCQ+5tpLw9bJebGN73lgBn2Nf3dhHEE5basQi+I6l2KiV1Zm+5AUbLIiMaioos5uJmalHUf14WkCaEeewaj6PYE9mlkOQ5JngBiWtVsaIMkD357cMr0anjgSv0W1HntRkCUt2AKLgdO7XYdbx4y6e6XSXq0JSWOQKPgg8JFfygr36f2VbUWlZRRaryJmwImWxO7ApYY8DIZ8JFamvfe+GNnY29kb36AagCiIGEVRJtZcwTEgnRuT8/yfcN0wOMWCWxZfT3Sy2Oo9rbkJSUGwCsgNxmCfwGDCTgNxtJUY7GVeSMjxdp3W9aNeWefRPfmzPYdpUMmoevLExS1M6c6Is+5r5BP+TDKVJCv21SKb1NbaM6RSJUULx4JgqUDRxg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5c70acf0-0d96-438d-b175-08d42822d515 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2474; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2474; 3:V8pxb7fNHU10oqtPUzGFvkIsBRJWiBnqt+9qaQSGH8AO4R4S55X2j/OOWPhIajCiI8Ev6o3wXB6GT6pU2kORa1A4ZPB2vbAWnUKuTvc6LLIl+Wp1mh8B/OoCI4ixm2WldC7fcyNXxFT0FwZ3s0ErIUstgQXKS5oSrZn9B6YJlgu+19ee3Dq6Rbi6yq9bi0oc/4/5/xw+53ZZIEG+OLdNudg+eG2xUZa0x3k07ZT/BnKCCYVnhG1DlWEfakesxHWgHSz5hgFToYMm3v7N/y0vAS0dYLfvETjh+FWfpoKWTSSJp2H1x+cVWPeLZ5MXhCwhKkZiHKKoDwpCbl1sASlGO3hD+LQKaYnVo35TG46fONIVIej5DtdXseZWf5jWqZ6c X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2474; 25:O+i433eV9K09TBL5vJ5XYm38GIejUe3HNIR9LqOp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X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(5005006)(8121501046)(13023025)(13024025)(13015025)(13017025)(13018025)(3002001)(10201501046)(6055026)(6096035)(20161123556025)(20161123559025)(20161123565025)(20161123563025)(20161123561025); SRVR:DM5PR03MB2474; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2474; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2474; 4:M7oU04mhWM7PQdCnIMQewNu4J7e0IeqEjfrST42HlJP9dm1UkpxPF2Om5SjNM0k5WqnqMyvK5H7tKYxMHl1mb88xhnnudr+e2Dc7cU2rkEoOVQdbAXoEYc3xUQxN7nV/m8F4BpXcRQ5Ts1yAew2ykW2yyzqZ2m141QCtlRXotFaNptAyexAh7/El58aVrh+iaN8UV3wKBvDT2QIAFCKJGbmjkr4W1r1IUHdvcnE9LXZtq2F2JoONknuR0X12al3GwPwpCa8AxxXBbU8QthuhhAsW3IMkxhvrgw4HtvrdaSwE2IOcNl77ZvBKk6jRemFUDEdfSSUqVvKRg3iiSO/HXwLvV2Cxg89s9OTPkzwlLnLju0m2ZFfoU/eQK6TUHiIfhApIbgbEVdUKGgNfbBHxMn4h8WBFEI/wCn+HiusAcrJCdwwmUyLqNsAgieNaEWKVdxtBTMJTQLURA6NmZa1lPjxfCbHGuCX4+JxJkv45sJwqayk2DkhhHVmPQq1PYuyY57eygZrxAXA9gmduWvYJc/jbJ3SV83pEkx7qttehwwP8fg1TYV7VQi8KQA7ibjeUbYpZv82gNqd1w/m5LG1pRlLPcP+Ej+0zNWBmo8pxxrfxxC+rDsN6FAVw6s/LRdv+pttsyBoB59V+tZvrbJKGR5w+PzblrtdpMmOnLddBGTtZW0xiOgE63b29iaOGNPeyg/PkZYaKj0WwPhXb4lc4Da6Q23JixElcsugLzE+eWAOFgplrdwu+DVrBjtyjZlGT X-Forefront-PRVS: 01613DFDC8 X-Microsoft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gBd1vxo9q58LFJsO6XsXNGAqHa+au; 5:Yw1bzXfiNtHZYHuKzC1FxJ6szWvBkkgLGjayR6RutY4slRI6p5y9tQhKU83SuKPLVltkmgmAua5G1GjU3xG8LgfDRD/0sNoi2psLb2vk7PfgH029wl6HS1GeZjBKtgcLwdZLHyA1PGv/OAR7qweHmQUawYxUioVLqq0///2xvoo5+J1+AE4CVG3GfzR7ij7l; 24:xCi0AtokaM+ym1EAiLd8GGMxNzC8BwXsC7ZtkvlnKLM1BNXM4CQ6rNpKZteaT3TkRJ9ZObTJjWttMZ6Ii4eWP6LgEK60/G4tiH/9Vhuy+IE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2474; 7:/8Ed6sbSc9ppY+A7+KyuU2BXkeobix2jYcOBMHju6CnYZYYJm19ujQ5Xj7SJK8rcZlD0ywBx3eGRS/H8w4yAiDk3at/AKnhKA+LRYiJ7hzc1T1vyxOhq6UqEImYua/YzAoM1Y+v01L6umzo67+GnlFWDLNXVh1O1UI9tmeXNYS7CQbxHivpZM8R201r76JjIssD++ce4CIFjpIHPCQlVIQMGIveeoh5+cmUcwUSL5D2j17qbTcWBQ51S4xPASHRYXs2mPWeFHv9Gw1WahXIoEeJl4y9IWTpq+0zDbkVgRbt3n6CswK/H4sf8Lj8825XXxeAt79tf97EgBf9lpvwgM5kN1awgqG6pTaYspIVtvL0XD05QV/0YD7UkeXPXyzzCdeFIaYjsEV+EwEOMJem5Bg6A7z2Ay9z8j3ie/RwS5jaXf9LrbJ1jy+SHpx7cObWGajCxa7kFeXxapmuvGCh/hA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2016 15:22:23.2554 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2474 Subject: [dpdk-dev] [PATCHv2 32/34] 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, 19 Dec 2016 15:22:26 -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/common/dpaa2/dpio/dpaa2_hw_pvt.h | 65 +++++++++++++++++++++++++++++++ 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, 94 insertions(+), 12 deletions(-) diff --git a/config/common_base b/config/common_base index 493811f..35a580e 100644 --- a/config/common_base +++ b/config/common_base @@ -277,6 +277,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/common/dpaa2/dpio/dpaa2_hw_pvt.h b/drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h index 378d591..6e28d1a 100644 --- a/drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h +++ b/drivers/common/dpaa2/dpio/dpaa2_hw_pvt.h @@ -166,4 +166,69 @@ 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 */ #endif 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 f609af7..fbae6cb 100644 --- a/drivers/pool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.c @@ -226,9 +226,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); @@ -237,8 +242,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, @@ -311,6 +323,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