From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH 3/4] test/extmem: check if memseg list is external Date: Fri, 21 Dec 2018 11:09:14 +0000 Message-ID: References: Cc: thomas@monjalon.net, stephen@networkplumber.org To: dev@dpdk.org Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E3EB629C6 for ; Fri, 21 Dec 2018 12:09:22 +0100 (CET) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Extend the extmem autotest to check whether the memseg lists for externally allocated memory are always marked as external. Signed-off-by: Anatoly Burakov --- 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 845c625d6..5557f6e3f 100644 --- a/test/test/test_external_mem.c +++ b/test/test/test_external_mem.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -29,10 +30,18 @@ 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); - 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