DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, stephen@networkplumber.org
Subject: [dpdk-dev] [PATCH v2 3/4] test/extmem: check if memseg list is external
Date: Fri, 21 Dec 2018 11:29:02 +0000	[thread overview]
Message-ID: <d5cb333bee4818f3cbb031a711a9eec2ae85c801.1545391716.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <c822e5e21620d0fa4b2930d9e89bce44e80eac73.1545391716.git.anatoly.burakov@intel.com>
In-Reply-To: <c822e5e21620d0fa4b2930d9e89bce44e80eac73.1545390524.git.anatoly.burakov@intel.com>

Extend the extmem autotest to check whether the memseg lists for
externally allocated memory are always marked as external.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 test/test/test_external_mem.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/test/test_external_mem.c b/test/test/test_external_mem.c
index 06e6ccc1d..b877f8e2e 100644
--- a/test/test/test_external_mem.c
+++ b/test/test/test_external_mem.c
@@ -13,6 +13,7 @@
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
+#include <rte_eal_memconfig.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
@@ -29,11 +30,19 @@ check_mem(void *addr, rte_iova_t *iova, size_t pgsz, int n_pages)
 
 	/* check that we can get this memory from EAL now */
 	for (i = 0; i < n_pages; i++) {
+		const struct rte_memseg_list *msl;
 		const struct rte_memseg *ms;
 		void *cur = RTE_PTR_ADD(addr, pgsz * i);
 		rte_iova_t expected_iova;
 
-		ms = rte_mem_virt2memseg(cur, NULL);
+		msl = rte_mem_virt2memseg_list(cur);
+		if (!msl->external) {
+			printf("%s():%i: Memseg list is not marked as external\n",
+				__func__, __LINE__);
+			return -1;
+		}
+
+		ms = rte_mem_virt2memseg(cur, msl);
 		if (ms == NULL) {
 			printf("%s():%i: Failed to retrieve memseg for external mem\n",
 				__func__, __LINE__);
-- 
2.17.1

  parent reply	other threads:[~2018-12-21 11:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21 11:09 [dpdk-dev] [PATCH 1/4] test/extmem: refactor and rename test functions Anatoly Burakov
2018-12-21 11:09 ` [dpdk-dev] [PATCH 2/4] test/extmem: extend autotest to test without IOVA table Anatoly Burakov
2018-12-21 11:09 ` [dpdk-dev] [PATCH 3/4] test/extmem: check if memseg list is external Anatoly Burakov
2018-12-21 11:09 ` [dpdk-dev] [PATCH 4/4] test/extmem: extend test to cover non-heap API Anatoly Burakov
2018-12-21 11:29 ` [dpdk-dev] [PATCH v2 1/4] test/extmem: refactor and rename test functions Anatoly Burakov
2018-12-21 11:29 ` [dpdk-dev] [PATCH v2 2/4] test/extmem: extend autotest to test without IOVA table Anatoly Burakov
2018-12-21 11:29 ` Anatoly Burakov [this message]
2018-12-21 11:29 ` [dpdk-dev] [PATCH v2 4/4] test/extmem: extend test to cover non-heap API Anatoly Burakov
2018-12-21 15:19   ` 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=d5cb333bee4818f3cbb031a711a9eec2ae85c801.1545391716.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).