DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: ajit.khaparde@broadcom.com
Cc: fangfangx.wei@intel.com, dev@dpdk.org
Subject: [dpdk-dev] [PATCH] mem: support page locking on FreeBSD
Date: Thu, 15 Jun 2017 19:50:55 +0200	[thread overview]
Message-ID: <20170615175055.27032-1-thomas@monjalon.net> (raw)
In-Reply-To: <067B569323FEB248B5CB480E1954F4346F4155FA@SHSMSX101.ccr.corp.intel.com>

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 <fangfangx.wei@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 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 <stdint.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <unistd.h>
 #include <inttypes.h>
+#include <sys/mman.h>
 #include <sys/queue.h>
 
 #include <rte_memory.h>
@@ -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

  reply	other threads:[~2017-06-15 17:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ac403b$3dpoa8@fmsmga006.fm.intel.com>
2017-06-15 13:43 ` [dpdk-dev] [dpdk-test-report] | ERROR | daily Intel builds (57/60) Wei, FangfangX
2017-06-15 17:50   ` Thomas Monjalon [this message]
2017-06-16 14:31     ` [dpdk-dev] [PATCH] mem: support page locking on FreeBSD Bruce Richardson
2017-06-16 14:52       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170615175055.27032-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=fangfangx.wei@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).