From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1134-209.mail.aliyun.com (out1134-209.mail.aliyun.com [42.120.134.209]) by dpdk.org (Postfix) with ESMTP id 99E383989 for ; Wed, 5 Nov 2014 14:16:07 +0100 (CET) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.4941507|-1; FP=0|0|0|0|0|-1|-1|-1; HT=r41g08152; MF=liang.xu@cinfotech.cn; PH=DS; RN=3; RT=3; SR=0; Received: from localhost.localdomain(mailfrom:liang.xu@cinfotech.cn ip:222.65.239.251) by smtp.aliyun-inc.com(10.147.11.248); Wed, 05 Nov 2014 21:25:24 +0800 From: lxu To: dev@dpdk.org Date: Wed, 5 Nov 2014 21:25:19 +0800 Message-Id: <1415193919-17361-1-git-send-email-liang.xu@cinfotech.cn> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] eal: map uio resources after hugepages when the base_virtaddr is configured. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2014 13:16:10 -0000 --- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index 7e62266..bc7ed3a 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -289,6 +289,11 @@ pci_uio_map_resource(struct rte_pci_device *dev) struct rte_pci_addr *loc = &dev->addr; struct mapped_pci_resource *uio_res; struct pci_map *maps; + static void * requested_addr = NULL; + if (internal_config.base_virtaddr && NULL == requested_addr) { + requested_addr = (uint8_t *) internal_config.base_virtaddr + + internal_config.memory; + } dev->intr_handle.fd = -1; dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; @@ -371,10 +376,12 @@ pci_uio_map_resource(struct rte_pci_device *dev) if (maps[j].addr != NULL) fail = 1; else { - mapaddr = pci_map_resource(NULL, fd, (off_t)offset, + mapaddr = pci_map_resource(requested_addr, fd, (off_t)offset, (size_t)maps[j].size); if (mapaddr == NULL) fail = 1; + else if (NULL != requested_addr) + requested_addr = (uint8_t *)mapaddr + maps[j].size; } if (fail) { -- 1.9.1