From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f169.google.com (mail-we0-f169.google.com [74.125.82.169]) by dpdk.org (Postfix) with ESMTP id 5AC6F6A94 for ; Fri, 28 Feb 2014 09:20:19 +0100 (CET) Received: by mail-we0-f169.google.com with SMTP id t61so270629wes.14 for ; Fri, 28 Feb 2014 00:21:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=dhRdKnhF28mmqtCK8FH6IFcVnx6NUdBiHdIPIrFNDDY=; b=DUhn14vnrSynxUMojBeO7JG9B9zGGh3atg0AMmMtG8EwfHFrwflgIyOKsHZGQaWlqN 0iqgg+r9MTFyJtGdNTypm6CYL8wucSWT4xcMX28bRZcFv8CAzSAahFJzD2dpQkdrIyvS d3lsdk93IJj5d5pxijI52JHSAXnc7YodWdrjfGnGXY5yIO9DWMVw+ANMxLmzuZiaq2v1 rQ814Sw4BYspMWkTBwUspj84/9SyUwkA008bYJajcyiqrvY7cflRLbJeavF5RV2/1pPe qZ5F88Krm470eD5iZMYt2i/LatAaAnnZQesc3Ng1RN55Sxe4StqOCT8g5jkAe7iJQ4yj G0Xw== X-Gm-Message-State: ALoCoQk6gNu+8J3adLmV/+BzLf4dn63hqSjV5zFt7LNhyrJWxRDLm810fXwc0ESwYmuqkyhK+RnT X-Received: by 10.180.164.73 with SMTP id yo9mr1226701wib.29.1393575706118; Fri, 28 Feb 2014 00:21:46 -0800 (PST) Received: from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id jw4sm2396667wjc.20.2014.02.28.00.21.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2014 00:21:45 -0800 (PST) From: David Marchand To: liljegren.mats2@gmail.com Date: Fri, 28 Feb 2014 09:21:36 +0100 Message-Id: <1393575696-25289-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1393575696-25289-1-git-send-email-david.marchand@6wind.com> References: <1393575696-25289-1-git-send-email-david.marchand@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH 2/2] mem: fix build on 32bits system 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: Fri, 28 Feb 2014 08:20:20 -0000 Rebase commit 57c24af85d9eaa81549a212169605b4e2468a29f introduced a build regression for 32bits system. CC eal_memory.o /home/marchand/dpdk.org/lib/librte_eal/linuxapp/eal/eal_memory.c: In function ‘rte_mem_virt2phy’: /home/marchand/dpdk.org/lib/librte_eal/linuxapp/eal/eal_memory.c:140:12: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] virtual = (uint64_t) virtaddr; ^ cc1: all warnings being treated as errors Rework this patch so that it is equivalent to what we had in 1.5.2. Signed-off-by: David Marchand --- lib/librte_eal/linuxapp/eal/eal_memory.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 296f172..242f1b3 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -131,13 +131,14 @@ phys_addr_t rte_mem_virt2phy(const void *virtaddr) { int fd; - uint64_t page, physaddr, virtual; - unsigned long virt_pfn; int page_size; + unsigned long virtual; + uint64_t page; + off_t offset; /* standard page size */ page_size = getpagesize(); - virtual = (uint64_t) virtaddr; + virtual = (unsigned long) virtaddr; fd = open("/proc/self/pagemap", O_RDONLY); if (fd < 0) { @@ -146,9 +147,7 @@ rte_mem_virt2phy(const void *virtaddr) return (uint64_t) -1; } - off_t offset; - virt_pfn = (unsigned long)virtaddr / page_size; - offset = sizeof(uint64_t) * virt_pfn; + offset = sizeof(uint64_t) * virtual / page_size; if (lseek(fd, offset, SEEK_SET) == (off_t) -1) { RTE_LOG(ERR, EAL, "%s(): seek error in /proc/self/pagemap: %s\n", __func__, strerror(errno)); @@ -166,9 +165,8 @@ rte_mem_virt2phy(const void *virtaddr) * the pfn (page frame number) are bits 0-54 (see * pagemap.txt in linux Documentation) */ - physaddr = ((page & 0x7fffffffffffffULL) * page_size) + (virtual % page_size); close(fd); - return physaddr; + return ((page & 0x7fffffffffffffULL) * page_size) + (virtual % page_size); } /* -- 1.7.10.4