From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 1FB1D2BB1 for ; Thu, 15 Jun 2017 19:51:19 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 87D1A207DD; Thu, 15 Jun 2017 13:51:19 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 15 Jun 2017 13:51:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=c6h rcitv5Cewle8DLGjPl/JRrnS2apS1egow9zg36zQ=; b=RfYlwBh7NPxUARf62yi VxIUJmWpiioW3i6RRiKjeYs6QuI2DnTQY/S2RiTA+I9PuNKhm8+xhmaZPdPGiDxg UapbJng1Bs3Iv1Qo7ffzuR7VMtp8j/e5plzh6iuNlZVj0zfvNGRGiLio28rUWJ5H ynaYwYJjuFGilgux+KpSUCKE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=c6hrcitv5Cewle8DLGjPl/JRrnS2apS1egow9zg36 zQ=; b=OTqr7+kWPWjJryTNeyGqZ+Fzvk3ssMTEyTPgVofcJdC5im0bZFZRZn7fU qtCdx9MfpYKosk1CaOt7TyKYE/z+XSk0t5eVxMu3jhGzhYCV9ceUGE+t+02r7mQk 6VDdGPrwyjCVZ0PnIFv6MZLbpB93bEOlj9kL5u7z6LkNyj2riPhERTrI4E1jHP0O Ik/yk6F9/B4pXYTc0oDBvWL53TwlnhIhMoek5DvwN2TeAeJyDp3JbN8eZRwUbSz+ usGlOd/YioTDMr4lgUCrktMKLkIryMq7AeUZQX4dKRmoD0ALpU+kdvjOLlZ+By7Q 4saH1HmLHOe36YiYQubEoiX4R2aXg== X-ME-Sender: X-Sasl-enc: EN52O0cf3iKYVA1gg0BRQ7bRtVMPaEFnRaT5/jIQVhBz 1497549079 Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D4CA82492D; Thu, 15 Jun 2017 13:51:18 -0400 (EDT) From: Thomas Monjalon To: ajit.khaparde@broadcom.com Cc: fangfangx.wei@intel.com, dev@dpdk.org Date: Thu, 15 Jun 2017 19:50:55 +0200 Message-Id: <20170615175055.27032-1-thomas@monjalon.net> X-Mailer: git-send-email 2.13.1 In-Reply-To: <067B569323FEB248B5CB480E1954F4346F4155FA@SHSMSX101.ccr.corp.intel.com> References: <067B569323FEB248B5CB480E1954F4346F4155FA@SHSMSX101.ccr.corp.intel.com> Subject: [dpdk-dev] [PATCH] mem: support page locking on FreeBSD 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: Thu, 15 Jun 2017 17:51:20 -0000 The function rte_mem_lock_page() was added for Linux only. The file eal_common_memory.c is a better place to make it available in FreeBSD also. The issue is seen when trying to compile bnxt on FreeBSD: bnxt_hwrm.c: undefined reference to `rte_mem_lock_page' Fixes: 3097de6e6bfb ("mem: get physical address of any pointer") Reported-by: Fangfang Wei Signed-off-by: Thomas Monjalon --- lib/librte_eal/common/eal_common_memory.c | 12 ++++++++++++ lib/librte_eal/linuxapp/eal/eal_memory.c | 10 ---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c index 6155752e9..279457001 100644 --- a/lib/librte_eal/common/eal_common_memory.c +++ b/lib/librte_eal/common/eal_common_memory.c @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #include #include @@ -135,6 +137,16 @@ rte_eal_memdevice_init(void) return 0; } +/* Lock page in physical memory and prevent from swapping. */ +int +rte_mem_lock_page(const void *virt) +{ + unsigned long virtual = (unsigned long)virt; + int page_size = getpagesize(); + unsigned long aligned = (virtual & ~ (page_size - 1)); + return mlock((void*)aligned, page_size); +} + /* init memory subsystem */ int rte_eal_memory_init(void) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 9c9baf628..e17c9cb5d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -118,16 +118,6 @@ test_phys_addrs_available(void) } } -/* Lock page in physical memory and prevent from swapping. */ -int -rte_mem_lock_page(const void *virt) -{ - unsigned long virtual = (unsigned long)virt; - int page_size = getpagesize(); - unsigned long aligned = (virtual & ~ (page_size - 1)); - return mlock((void*)aligned, page_size); -} - /* * Get physical address of any mapped virtual address in the current process. */ -- 2.13.1